diff options
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Drop.hs | 6 | ||||
-rw-r--r-- | Command/InAnnex.hs | 11 | ||||
-rw-r--r-- | Command/Move.hs | 6 |
3 files changed, 12 insertions, 11 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs index e81bd9d7d..44685ffcd 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -52,7 +52,7 @@ startRemote file numcopies key remote = do next $ performRemote key numcopies remote performLocal :: Key -> Maybe Int -> CommandPerform -performLocal key numcopies = lockExclusive key $ do +performLocal key numcopies = lockContent key $ do (remotes, trusteduuids) <- Remote.keyPossibilitiesTrusted key untrusteduuids <- trustGet UnTrusted let tocheck = Remote.remotesWithoutUUID remotes (trusteduuids++untrusteduuids) @@ -64,7 +64,7 @@ performLocal key numcopies = lockExclusive key $ do else stop performRemote :: Key -> Maybe Int -> Remote.Remote Annex -> CommandPerform -performRemote key numcopies remote = lockExclusive key $ do +performRemote key numcopies remote = lockContent key $ do -- Filter the remote it's being dropped from out of the lists of -- places assumed to have the key, and places to check. -- When the local repo has the key, that's one additional copy. @@ -95,7 +95,7 @@ cleanupRemote key remote ok = do -- better safe than sorry: assume the remote dropped the key -- even if it seemed to fail; the failure could have occurred -- after it really dropped it - Remote.remoteHasKey remote key False + Remote.logStatus remote key False return ok {- Checks specified remotes to verify that enough copies of a key exist to diff --git a/Command/InAnnex.hs b/Command/InAnnex.hs index 9c169d0d7..c41f9a92c 100644 --- a/Command/InAnnex.hs +++ b/Command/InAnnex.hs @@ -19,8 +19,9 @@ seek :: [CommandSeek] seek = [withKeys start] start :: Key -> CommandStart -start key = do - present <- inAnnex key - if present - then stop - else liftIO exitFailure +start key = inAnnexSafe key >>= dispatch + where + dispatch (Just True) = stop + dispatch (Just False) = exit 1 + dispatch Nothing = exit 100 + exit n = liftIO $ exitWith $ ExitFailure n diff --git a/Command/Move.hs b/Command/Move.hs index e955de827..f02f32558 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -82,7 +82,7 @@ toPerform dest move key = moveLock move key $ do else Remote.hasKey dest key case isthere of Left err -> do - showNote $ show err + showNote $ err stop Right False -> do showAction $ "to " ++ Remote.name dest @@ -96,7 +96,7 @@ toPerform dest move key = moveLock move key $ do Right True -> finish where finish = do - Remote.remoteHasKey dest key True + Remote.logStatus dest key True if move then do whenM (inAnnex key) $ removeAnnex key @@ -137,5 +137,5 @@ fromPerform src move key = moveLock move key $ do {- Locks a key in order for it to be moved. - No lock is needed when a key is being copied. -} moveLock :: Bool -> Key -> Annex a -> Annex a -moveLock True key a = lockExclusive key a +moveLock True key a = lockContent key a moveLock False _ a = a |