summaryrefslogtreecommitdiff
path: root/Command/Drop.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-24 16:30:15 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-24 16:30:15 -0400
commita00262011dc7f4ccac8c5c40d845224c281c56b2 (patch)
treee59997bf6b311fdfdd0ba80d864864c40e78484b /Command/Drop.hs
parentac4be3de323345ab4a6cb4a624b975ac686cc2d5 (diff)
webapp and assistant glacier support
Diffstat (limited to 'Command/Drop.hs')
-rw-r--r--Command/Drop.hs21
1 files changed, 12 insertions, 9 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs
index 6c210b1e1..e7b52124f 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -34,29 +34,32 @@ start :: Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart
start from file (key, _) = autoCopiesWith file key (>) $ \numcopies ->
stopUnless (checkAuto $ wantDrop (Remote.uuid <$> from) (Just file)) $
case from of
- Nothing -> startLocal file numcopies key
+ Nothing -> startLocal file numcopies key Nothing
Just remote -> do
u <- getUUID
if Remote.uuid remote == u
- then startLocal file numcopies key
+ then startLocal file numcopies key Nothing
else startRemote file numcopies key remote
-startLocal :: FilePath -> Maybe Int -> Key -> CommandStart
-startLocal file numcopies key = stopUnless (inAnnex key) $ do
+startLocal :: FilePath -> Maybe Int -> Key -> Maybe Remote -> CommandStart
+startLocal file numcopies key knownpresentremote = stopUnless (inAnnex key) $ do
showStart "drop" file
- next $ performLocal key numcopies
+ next $ performLocal key numcopies knownpresentremote
startRemote :: FilePath -> Maybe Int -> Key -> Remote -> CommandStart
startRemote file numcopies key remote = do
showStart ("drop " ++ Remote.name remote) file
next $ performRemote key numcopies remote
-performLocal :: Key -> Maybe Int -> CommandPerform
-performLocal key numcopies = lockContent key $ do
+performLocal :: Key -> Maybe Int -> Maybe Remote -> CommandPerform
+performLocal key numcopies knownpresentremote = lockContent key $ do
(remotes, trusteduuids) <- Remote.keyPossibilitiesTrusted key
+ let trusteduuids' = case knownpresentremote of
+ Nothing -> trusteduuids
+ Just r -> nub (Remote.uuid r:trusteduuids)
untrusteduuids <- trustGet UnTrusted
- let tocheck = Remote.remotesWithoutUUID remotes (trusteduuids++untrusteduuids)
- stopUnless (canDropKey key numcopies trusteduuids tocheck []) $ do
+ let tocheck = Remote.remotesWithoutUUID remotes (trusteduuids'++untrusteduuids)
+ stopUnless (canDropKey key numcopies trusteduuids' tocheck []) $ do
whenM (inAnnex key) $ removeAnnex key
next $ cleanupLocal key