summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-11 18:54:52 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-11 18:54:52 -0400
commitda0de293d16ace6aac574d0cdc37ec41715b7d66 (patch)
tree4ebabdd2e3afa95127441909c8a423eecda7d81c /Command
parent5357d3a37af9e3d3a0aec207a8ba7fb94bfea953 (diff)
refactor param seeking
Diffstat (limited to 'Command')
-rw-r--r--Command/Add.hs4
-rw-r--r--Command/Drop.hs3
-rw-r--r--Command/DropKey.hs3
-rw-r--r--Command/Fix.hs3
-rw-r--r--Command/FromKey.hs3
-rw-r--r--Command/Fsck.hs3
-rw-r--r--Command/Get.hs3
-rw-r--r--Command/Init.hs3
-rw-r--r--Command/Lock.hs3
-rw-r--r--Command/Move.hs5
-rw-r--r--Command/PreCommit.hs9
-rw-r--r--Command/SetKey.hs3
-rw-r--r--Command/Unannex.hs3
-rw-r--r--Command/Unlock.hs3
14 files changed, 48 insertions, 3 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index 649b466bb..586807b53 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -18,6 +18,10 @@ import Types
import Core
import Messages
+{- Add acts on both files not checked into git yet, and unlocked files. -}
+seek :: [SubCmdSeek]
+seek = [withFilesNotInGit start, withFilesUnlocked start]
+
{- The add subcommand annexes a file, storing it in a backend, and then
- moving it into the annex directory and setting up the symlink pointing
- to its content. -}
diff --git a/Command/Drop.hs b/Command/Drop.hs
index 48433b14c..1e73d8b82 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -16,6 +16,9 @@ import Types
import Core
import Messages
+seek :: [SubCmdSeek]
+seek = [withFilesInGit start]
+
{- Indicates a file's content is not wanted anymore, and should be removed
- if it's safe to do so. -}
start :: SubCmdStartString
diff --git a/Command/DropKey.hs b/Command/DropKey.hs
index e0b20918c..34010481d 100644
--- a/Command/DropKey.hs
+++ b/Command/DropKey.hs
@@ -15,6 +15,9 @@ import Types
import Core
import Messages
+seek :: [SubCmdSeek]
+seek = [withKeys start]
+
{- Drops cached content for a key. -}
start :: SubCmdStartString
start keyname = do
diff --git a/Command/Fix.hs b/Command/Fix.hs
index 9db832cc7..323aca95e 100644
--- a/Command/Fix.hs
+++ b/Command/Fix.hs
@@ -17,6 +17,9 @@ import Utility
import Core
import Messages
+seek :: [SubCmdSeek]
+seek = [withFilesInGit start]
+
{- Fixes the symlink to an annexed file. -}
start :: SubCmdStartString
start file = isAnnexed file $ \(key, _) -> do
diff --git a/Command/FromKey.hs b/Command/FromKey.hs
index 229a93684..f25de23a2 100644
--- a/Command/FromKey.hs
+++ b/Command/FromKey.hs
@@ -20,6 +20,9 @@ import Types
import Core
import Messages
+seek :: [SubCmdSeek]
+seek = [withFilesMissing start]
+
{- Adds a file pointing at a manually-specified key -}
start :: SubCmdStartString
start file = do
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 5405ce120..e5f0debe0 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -14,6 +14,9 @@ import Types
import Core
import Messages
+seek :: [SubCmdSeek]
+seek = [withNothing start]
+
{- Checks the whole annex for problems. -}
start :: SubCmdStart
start = do
diff --git a/Command/Get.hs b/Command/Get.hs
index c50b5a377..13d137537 100644
--- a/Command/Get.hs
+++ b/Command/Get.hs
@@ -13,6 +13,9 @@ import Types
import Core
import Messages
+seek :: [SubCmdSeek]
+seek = [withFilesInGit start]
+
{- Gets an annexed file from one of the backends. -}
start :: SubCmdStartString
start file = isAnnexed file $ \(key, backend) -> do
diff --git a/Command/Init.hs b/Command/Init.hs
index fa5725c48..e3b05a83f 100644
--- a/Command/Init.hs
+++ b/Command/Init.hs
@@ -18,6 +18,9 @@ import UUID
import Version
import Messages
+seek :: [SubCmdSeek]
+seek = [withDescription start]
+
{- Stores description for the repository etc. -}
start :: SubCmdStartString
start description = do
diff --git a/Command/Lock.hs b/Command/Lock.hs
index f03d6b6c8..27a030bc2 100644
--- a/Command/Lock.hs
+++ b/Command/Lock.hs
@@ -15,6 +15,9 @@ import Messages
import qualified Annex
import qualified GitRepo as Git
+seek :: [SubCmdSeek]
+seek = [withFilesUnlocked start]
+
{- Undo unlock -}
start :: SubCmdStartBackendFile
start (file, _) = do
diff --git a/Command/Move.hs b/Command/Move.hs
index e0b079193..7f8f40737 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -11,7 +11,7 @@ import Control.Monad.State (liftIO)
import Monad (when)
import Command
-import Command.Drop
+import qualified Command.Drop
import qualified Annex
import Locations
import LocationLog
@@ -22,6 +22,9 @@ import qualified Remotes
import UUID
import Messages
+seek :: [SubCmdSeek]
+seek = [withFilesInGit start]
+
{- Move a file either --to or --from a repository.
-
- This only operates on the cached file content; it does not involve
diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs
index b3b940cdd..a15510bd9 100644
--- a/Command/PreCommit.hs
+++ b/Command/PreCommit.hs
@@ -14,9 +14,14 @@ import qualified Annex
import qualified Backend
import qualified GitRepo as Git
import qualified Command.Add
+import qualified Command.Fix
+
+{- The pre-commit hook needs to fix symlinks to all files being committed.
+ - And, it needs to inject unlocked files into the annex. -}
+seek :: [SubCmdSeek]
+seek = [withFilesToBeCommitted Command.Fix.start,
+ withUnlockedFilesToBeCommitted start]
-{- Run by git pre-commit hook; passed unlocked files that are being
- - committed. -}
start :: SubCmdStartString
start file = return $ Just $ perform file
diff --git a/Command/SetKey.hs b/Command/SetKey.hs
index 50e9a590b..e8d407b83 100644
--- a/Command/SetKey.hs
+++ b/Command/SetKey.hs
@@ -19,6 +19,9 @@ import Types
import Core
import Messages
+seek :: [SubCmdSeek]
+seek = [withTempFile start]
+
{- Sets cached content for a key. -}
start :: SubCmdStartString
start file = do
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index f5e78e55a..e85e8486f 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -20,6 +20,9 @@ import Core
import qualified GitRepo as Git
import Messages
+seek :: [SubCmdSeek]
+seek = [withFilesInGit start]
+
{- The unannex subcommand undoes an add. -}
start :: SubCmdStartString
start file = isAnnexed file $ \(key, backend) -> do
diff --git a/Command/Unlock.hs b/Command/Unlock.hs
index de21988de..3ff3023b2 100644
--- a/Command/Unlock.hs
+++ b/Command/Unlock.hs
@@ -18,6 +18,9 @@ import Locations
import Utility
import Core
+seek :: [SubCmdSeek]
+seek = [withFilesInGit start]
+
{- The unlock subcommand replaces the symlink with a copy of the file's
- content. -}
start :: SubCmdStartString