summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-10 22:37:52 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-10 22:37:52 -0400
commit4389782628a1cc683ef238e848b6311fc4bd82c3 (patch)
tree0b7e6e776a5bcaa945c72f73ed08af3551651206 /Command
parent2de1e2c2cee4ea75b971000fe480c48b6cbaab29 (diff)
tweak
Diffstat (limited to 'Command')
-rw-r--r--Command/Move.hs22
1 files changed, 11 insertions, 11 deletions
diff --git a/Command/Move.hs b/Command/Move.hs
index 9a6b0190e..ffa246ab6 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -28,7 +28,7 @@ seek = [withFilesInGit $ start True]
- This only operates on the cached file content; it does not involve
- moving data in the key-value backend. -}
start :: Bool -> FilePath -> CommandStart
-start move file = do
+start move file = isAnnexed file $ \(key, _) -> do
noAuto
to <- Annex.getState Annex.toremote
from <- Annex.getState Annex.fromremote
@@ -36,10 +36,10 @@ start move file = do
(Nothing, Nothing) -> error "specify either --from or --to"
(Nothing, Just name) -> do
dest <- Remote.byName name
- toStart dest move file
+ toStart dest move file key
(Just name, Nothing) -> do
src <- Remote.byName name
- fromStart src move file
+ fromStart src move file key
(_ , _) -> error "only one of --from or --to can be specified"
where
noAuto = when move $ whenM (Annex.getState Annex.auto) $ error
@@ -58,8 +58,8 @@ showMoveAction False file = showStart "copy" file
- A file's content can be moved even if there are insufficient copies to
- allow it to be dropped.
-}
-toStart :: Remote.Remote Annex -> Bool -> FilePath -> CommandStart
-toStart dest move file = isAnnexed file $ \(key, _) -> do
+toStart :: Remote.Remote Annex -> Bool -> FilePath -> Key -> CommandStart
+toStart dest move file key = do
u <- getUUID
ishere <- inAnnex key
if not ishere || u == Remote.uuid dest
@@ -109,14 +109,14 @@ toPerform dest move key = moveLock move key $ do
- If the current repository already has the content, it is still removed
- from the remote.
-}
-fromStart :: Remote.Remote Annex -> Bool -> FilePath -> CommandStart
-fromStart src move file
- | move == True = isAnnexed file $ \(key, _) -> go key
- | otherwise = isAnnexed file $ \(key, _) -> do
+fromStart :: Remote.Remote Annex -> Bool -> FilePath -> Key -> CommandStart
+fromStart src move file key
+ | move == True = go
+ | otherwise = do
ishere <- inAnnex key
- if ishere then stop else go key
+ if ishere then stop else go
where
- go key = do
+ go = do
u <- getUUID
remotes <- Remote.keyPossibilities key
if u == Remote.uuid src || not (any (== src) remotes)