summaryrefslogtreecommitdiff
path: root/Command
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
parentac4be3de323345ab4a6cb4a624b975ac686cc2d5 (diff)
webapp and assistant glacier support
Diffstat (limited to 'Command')
-rw-r--r--Command/Drop.hs21
-rw-r--r--Command/DropUnused.hs2
2 files changed, 13 insertions, 10 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
diff --git a/Command/DropUnused.hs b/Command/DropUnused.hs
index 00c0eec12..95af062f5 100644
--- a/Command/DropUnused.hs
+++ b/Command/DropUnused.hs
@@ -34,7 +34,7 @@ perform key = maybe droplocal dropremote =<< Remote.byName =<< from
showAction $ "from " ++ Remote.name r
ok <- Remote.removeKey r key
next $ Command.Drop.cleanupRemote key r ok
- droplocal = Command.Drop.performLocal key (Just 0) -- force drop
+ droplocal = Command.Drop.performLocal key (Just 0) Nothing -- force drop
from = Annex.getField $ Option.name Command.Drop.fromOption
performOther :: (Key -> Git.Repo -> FilePath) -> Key -> CommandPerform