2011-01-07 00:26:57 +00:00
|
|
|
{- git-annex main program
|
|
|
|
-
|
2013-12-11 03:19:18 +00:00
|
|
|
- Copyright 2010-2013 Joey Hess <joey@kitenet.net>
|
2011-01-07 00:26:57 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2013-11-06 20:33:45 +00:00
|
|
|
{-# LANGUAGE CPP, OverloadedStrings #-}
|
2012-06-26 13:15:47 +00:00
|
|
|
|
2011-01-07 00:26:57 +00:00
|
|
|
module GitAnnex where
|
|
|
|
|
2012-05-18 22:20:53 +00:00
|
|
|
import qualified Git.CurrentRepo
|
2011-01-07 06:15:10 +00:00
|
|
|
import CmdLine
|
2011-01-07 00:26:57 +00:00
|
|
|
import Command
|
2013-03-27 17:51:24 +00:00
|
|
|
import GitAnnex.Options
|
2011-01-07 00:26:57 +00:00
|
|
|
|
|
|
|
import qualified Command.Add
|
|
|
|
import qualified Command.Unannex
|
|
|
|
import qualified Command.Drop
|
|
|
|
import qualified Command.Move
|
|
|
|
import qualified Command.Copy
|
|
|
|
import qualified Command.Get
|
2013-12-15 18:02:23 +00:00
|
|
|
import qualified Command.LookupKey
|
2013-12-15 18:46:29 +00:00
|
|
|
import qualified Command.ExamineKey
|
2011-01-07 00:26:57 +00:00
|
|
|
import qualified Command.FromKey
|
|
|
|
import qualified Command.DropKey
|
2012-08-24 21:23:58 +00:00
|
|
|
import qualified Command.TransferKey
|
2013-03-19 20:58:36 +00:00
|
|
|
import qualified Command.TransferKeys
|
2012-02-16 20:36:35 +00:00
|
|
|
import qualified Command.ReKey
|
2011-10-31 19:18:41 +00:00
|
|
|
import qualified Command.Reinject
|
2011-01-07 00:26:57 +00:00
|
|
|
import qualified Command.Fix
|
|
|
|
import qualified Command.Init
|
2011-03-03 21:21:00 +00:00
|
|
|
import qualified Command.Describe
|
2011-03-29 03:22:31 +00:00
|
|
|
import qualified Command.InitRemote
|
2013-04-26 22:22:44 +00:00
|
|
|
import qualified Command.EnableRemote
|
2011-01-07 00:26:57 +00:00
|
|
|
import qualified Command.Fsck
|
2013-10-23 16:21:59 +00:00
|
|
|
import qualified Command.Repair
|
2011-01-07 00:26:57 +00:00
|
|
|
import qualified Command.Unused
|
|
|
|
import qualified Command.DropUnused
|
2012-05-02 18:59:05 +00:00
|
|
|
import qualified Command.AddUnused
|
2011-01-07 00:26:57 +00:00
|
|
|
import qualified Command.Unlock
|
|
|
|
import qualified Command.Lock
|
|
|
|
import qualified Command.PreCommit
|
|
|
|
import qualified Command.Find
|
2011-03-05 21:23:55 +00:00
|
|
|
import qualified Command.Whereis
|
2013-09-19 18:16:28 +00:00
|
|
|
import qualified Command.List
|
2012-01-06 19:40:04 +00:00
|
|
|
import qualified Command.Log
|
2011-06-22 22:46:45 +00:00
|
|
|
import qualified Command.Merge
|
2013-11-07 16:45:59 +00:00
|
|
|
import qualified Command.Info
|
2011-05-17 01:18:34 +00:00
|
|
|
import qualified Command.Status
|
2011-01-08 19:54:14 +00:00
|
|
|
import qualified Command.Migrate
|
2011-01-07 00:26:57 +00:00
|
|
|
import qualified Command.Uninit
|
2014-01-20 20:47:56 +00:00
|
|
|
import qualified Command.NumCopies
|
2011-01-07 00:26:57 +00:00
|
|
|
import qualified Command.Trust
|
|
|
|
import qualified Command.Untrust
|
2011-01-26 19:37:16 +00:00
|
|
|
import qualified Command.Semitrust
|
2011-12-02 20:59:55 +00:00
|
|
|
import qualified Command.Dead
|
2012-10-01 19:12:04 +00:00
|
|
|
import qualified Command.Group
|
2013-10-28 18:08:38 +00:00
|
|
|
import qualified Command.Wanted
|
2013-10-13 19:40:38 +00:00
|
|
|
import qualified Command.Schedule
|
2012-10-01 19:12:04 +00:00
|
|
|
import qualified Command.Ungroup
|
2012-10-03 21:04:52 +00:00
|
|
|
import qualified Command.Vicfg
|
2011-12-10 00:27:22 +00:00
|
|
|
import qualified Command.Sync
|
2013-08-20 19:46:35 +00:00
|
|
|
import qualified Command.Mirror
|
2011-07-01 21:15:46 +00:00
|
|
|
import qualified Command.AddUrl
|
2013-07-28 19:27:36 +00:00
|
|
|
#ifdef WITH_FEED
|
|
|
|
import qualified Command.ImportFeed
|
|
|
|
#endif
|
2013-04-22 21:18:53 +00:00
|
|
|
import qualified Command.RmUrl
|
2012-05-31 23:47:18 +00:00
|
|
|
import qualified Command.Import
|
2011-02-03 22:55:12 +00:00
|
|
|
import qualified Command.Map
|
2012-12-13 19:44:56 +00:00
|
|
|
import qualified Command.Direct
|
|
|
|
import qualified Command.Indirect
|
2011-03-16 19:48:26 +00:00
|
|
|
import qualified Command.Upgrade
|
2013-08-28 20:38:03 +00:00
|
|
|
import qualified Command.Forget
|
2011-03-19 18:33:24 +00:00
|
|
|
import qualified Command.Version
|
2012-11-06 04:52:35 +00:00
|
|
|
import qualified Command.Help
|
2012-06-26 13:15:47 +00:00
|
|
|
#ifdef WITH_ASSISTANT
|
watch subcommand
So far this only handles auto-annexing new files that are created inside
the repository while it's running. To make this really useful,
it needs to at least:
- notice deleted files and stage the deletion
(tricky; there's a race with add..)
- notice renamed files, auto-fix the symlink, and stage the new file location
- periodically auto-commit staged changes
- honor .gitignore, not adding files it excludes
Also nice to have would be:
- Somehow sync remotes, possibly using a push sync like dvcs-autosync
does, so they are immediately updated.
- Somehow get content that is unavilable. This is problimatic with inotify,
since we only get an event once the user has tried (and failed) to read
from the file. Perhaps instead, automatically copy content that is added
out to remotes, with the goal of all repos eventually getting a copy,
if df allows.
- Drop files that have not been used lately, or meet some other criteria
(as long as there's a copy elsewhere).
- Perhaps automatically dropunused files that have been deleted,
although I cannot see a way to do that, since by the time the inotify
deletion event arrives, the file is deleted, and we cannot see what
its symlink pointed to! Alternatievely, perhaps automatically
do an expensive unused/dropunused cleanup process.
Some of this probably needs the currently stateless threads to maintain
a common state.
2012-04-12 21:29:43 +00:00
|
|
|
import qualified Command.Watch
|
2012-06-22 17:04:03 +00:00
|
|
|
import qualified Command.Assistant
|
2012-07-26 03:13:01 +00:00
|
|
|
#ifdef WITH_WEBAPP
|
|
|
|
import qualified Command.WebApp
|
|
|
|
#endif
|
2012-11-06 04:52:35 +00:00
|
|
|
#ifdef WITH_XMPP
|
|
|
|
import qualified Command.XMPPGit
|
|
|
|
#endif
|
2012-06-26 13:15:47 +00:00
|
|
|
#endif
|
2013-02-27 19:35:07 +00:00
|
|
|
import qualified Command.Test
|
2014-01-15 16:49:56 +00:00
|
|
|
#ifdef WITH_TESTSUITE
|
2013-05-23 23:00:46 +00:00
|
|
|
import qualified Command.FuzzTest
|
2013-02-27 19:59:31 +00:00
|
|
|
#endif
|
2013-11-06 20:33:45 +00:00
|
|
|
#ifdef WITH_EKG
|
|
|
|
import System.Remote.Monitoring
|
|
|
|
#endif
|
2011-01-07 00:26:57 +00:00
|
|
|
|
|
|
|
cmds :: [Command]
|
|
|
|
cmds = concat
|
2011-10-29 19:19:05 +00:00
|
|
|
[ Command.Add.def
|
|
|
|
, Command.Get.def
|
|
|
|
, Command.Drop.def
|
|
|
|
, Command.Move.def
|
|
|
|
, Command.Copy.def
|
|
|
|
, Command.Unlock.def
|
|
|
|
, Command.Lock.def
|
2011-12-10 00:27:22 +00:00
|
|
|
, Command.Sync.def
|
2013-08-20 19:46:35 +00:00
|
|
|
, Command.Mirror.def
|
2011-12-10 00:27:22 +00:00
|
|
|
, Command.AddUrl.def
|
2013-07-28 19:27:36 +00:00
|
|
|
#ifdef WITH_FEED
|
|
|
|
, Command.ImportFeed.def
|
|
|
|
#endif
|
2013-04-22 21:18:53 +00:00
|
|
|
, Command.RmUrl.def
|
2012-05-31 23:47:18 +00:00
|
|
|
, Command.Import.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.Init.def
|
|
|
|
, Command.Describe.def
|
|
|
|
, Command.InitRemote.def
|
2013-04-26 22:22:44 +00:00
|
|
|
, Command.EnableRemote.def
|
2011-10-31 19:18:41 +00:00
|
|
|
, Command.Reinject.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.Unannex.def
|
|
|
|
, Command.Uninit.def
|
|
|
|
, Command.PreCommit.def
|
2014-01-20 20:47:56 +00:00
|
|
|
, Command.NumCopies.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.Trust.def
|
|
|
|
, Command.Untrust.def
|
|
|
|
, Command.Semitrust.def
|
2011-12-02 20:59:55 +00:00
|
|
|
, Command.Dead.def
|
2012-10-01 19:12:04 +00:00
|
|
|
, Command.Group.def
|
2013-10-28 18:08:38 +00:00
|
|
|
, Command.Wanted.def
|
2013-10-13 19:40:38 +00:00
|
|
|
, Command.Schedule.def
|
2012-10-01 19:12:04 +00:00
|
|
|
, Command.Ungroup.def
|
2012-10-03 21:04:52 +00:00
|
|
|
, Command.Vicfg.def
|
2013-12-15 18:02:23 +00:00
|
|
|
, Command.LookupKey.def
|
2013-12-15 18:46:29 +00:00
|
|
|
, Command.ExamineKey.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.FromKey.def
|
|
|
|
, Command.DropKey.def
|
2012-08-24 21:23:58 +00:00
|
|
|
, Command.TransferKey.def
|
2013-03-19 20:58:36 +00:00
|
|
|
, Command.TransferKeys.def
|
2012-02-16 20:36:35 +00:00
|
|
|
, Command.ReKey.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.Fix.def
|
|
|
|
, Command.Fsck.def
|
2013-10-23 16:21:59 +00:00
|
|
|
, Command.Repair.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.Unused.def
|
|
|
|
, Command.DropUnused.def
|
2012-05-02 18:59:05 +00:00
|
|
|
, Command.AddUnused.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.Find.def
|
|
|
|
, Command.Whereis.def
|
2013-09-19 18:16:28 +00:00
|
|
|
, Command.List.def
|
2012-01-06 19:40:04 +00:00
|
|
|
, Command.Log.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.Merge.def
|
2013-11-07 16:45:59 +00:00
|
|
|
, Command.Info.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.Status.def
|
|
|
|
, Command.Migrate.def
|
|
|
|
, Command.Map.def
|
2012-12-13 19:44:56 +00:00
|
|
|
, Command.Direct.def
|
|
|
|
, Command.Indirect.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.Upgrade.def
|
2013-08-28 20:38:03 +00:00
|
|
|
, Command.Forget.def
|
2011-10-29 19:19:05 +00:00
|
|
|
, Command.Version.def
|
2012-11-06 04:52:35 +00:00
|
|
|
, Command.Help.def
|
2012-06-26 13:15:47 +00:00
|
|
|
#ifdef WITH_ASSISTANT
|
watch subcommand
So far this only handles auto-annexing new files that are created inside
the repository while it's running. To make this really useful,
it needs to at least:
- notice deleted files and stage the deletion
(tricky; there's a race with add..)
- notice renamed files, auto-fix the symlink, and stage the new file location
- periodically auto-commit staged changes
- honor .gitignore, not adding files it excludes
Also nice to have would be:
- Somehow sync remotes, possibly using a push sync like dvcs-autosync
does, so they are immediately updated.
- Somehow get content that is unavilable. This is problimatic with inotify,
since we only get an event once the user has tried (and failed) to read
from the file. Perhaps instead, automatically copy content that is added
out to remotes, with the goal of all repos eventually getting a copy,
if df allows.
- Drop files that have not been used lately, or meet some other criteria
(as long as there's a copy elsewhere).
- Perhaps automatically dropunused files that have been deleted,
although I cannot see a way to do that, since by the time the inotify
deletion event arrives, the file is deleted, and we cannot see what
its symlink pointed to! Alternatievely, perhaps automatically
do an expensive unused/dropunused cleanup process.
Some of this probably needs the currently stateless threads to maintain
a common state.
2012-04-12 21:29:43 +00:00
|
|
|
, Command.Watch.def
|
2012-06-22 17:04:03 +00:00
|
|
|
, Command.Assistant.def
|
2012-07-26 03:13:01 +00:00
|
|
|
#ifdef WITH_WEBAPP
|
|
|
|
, Command.WebApp.def
|
|
|
|
#endif
|
2012-11-06 04:52:35 +00:00
|
|
|
#ifdef WITH_XMPP
|
|
|
|
, Command.XMPPGit.def
|
|
|
|
#endif
|
2012-06-26 13:15:47 +00:00
|
|
|
#endif
|
2013-02-27 19:35:07 +00:00
|
|
|
, Command.Test.def
|
2014-01-17 18:48:56 +00:00
|
|
|
#ifdef WITH_TESTSUITE
|
2013-05-23 23:00:46 +00:00
|
|
|
, Command.FuzzTest.def
|
2013-02-27 19:59:31 +00:00
|
|
|
#endif
|
2011-01-07 00:26:57 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
header :: String
|
2013-03-27 17:51:24 +00:00
|
|
|
header = "git-annex command [option ...]"
|
2011-01-07 06:15:10 +00:00
|
|
|
|
|
|
|
run :: [String] -> IO ()
|
2013-11-06 20:33:45 +00:00
|
|
|
run args = do
|
|
|
|
#ifdef WITH_EKG
|
|
|
|
_ <- forkServer "localhost" 4242
|
|
|
|
#endif
|
|
|
|
dispatch True args cmds options [] header Git.CurrentRepo.get
|