summaryrefslogtreecommitdiff
path: root/Command/DropUnused.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-21 17:08:49 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-21 17:25:39 -0400
commitd44bd607d4fd18eadabe3c7693ebcf1c74aae63e (patch)
tree83e8867f45199ece960fc67e4d31f1d9b4a5d56a /Command/DropUnused.hs
parentd5f7fb27aad3e2e9c4bebb9ccd5577af8deb25c7 (diff)
numcopies cleanup, part 2
This includes several bug fixes.
Diffstat (limited to 'Command/DropUnused.hs')
-rw-r--r--Command/DropUnused.hs17
1 files changed, 10 insertions, 7 deletions
diff --git a/Command/DropUnused.hs b/Command/DropUnused.hs
index 5d7c5c1d2..043ddfe00 100644
--- a/Command/DropUnused.hs
+++ b/Command/DropUnused.hs
@@ -15,6 +15,7 @@ import qualified Remote
import qualified Git
import qualified Option
import Command.Unused (withUnusedMaps, UnusedMaps(..), startUnused)
+import Logs.NumCopies
def :: [Command]
def = [withOptions [Command.Drop.fromOption] $
@@ -22,18 +23,20 @@ def = [withOptions [Command.Drop.fromOption] $
seek SectionMaintenance "drop unused file content"]
seek :: CommandSeek
-seek = withUnusedMaps start
+seek ps = do
+ numcopies <- getNumCopies
+ withUnusedMaps (start numcopies) ps
-start :: UnusedMaps -> Int -> CommandStart
-start = startUnused "dropunused" perform (performOther gitAnnexBadLocation) (performOther gitAnnexTmpLocation)
+start :: NumCopies -> UnusedMaps -> Int -> CommandStart
+start numcopies = startUnused "dropunused" (perform numcopies) (performOther gitAnnexBadLocation) (performOther gitAnnexTmpLocation)
-perform :: Key -> CommandPerform
-perform key = maybe droplocal dropremote =<< Remote.byNameWithUUID =<< from
+perform :: NumCopies -> Key -> CommandPerform
+perform numcopies key = maybe droplocal dropremote =<< Remote.byNameWithUUID =<< from
where
dropremote r = do
showAction $ "from " ++ Remote.name r
- Command.Drop.performRemote key Nothing r
- droplocal = Command.Drop.performLocal key Nothing Nothing
+ Command.Drop.performRemote key numcopies r
+ droplocal = Command.Drop.performLocal key numcopies Nothing
from = Annex.getField $ Option.name Command.Drop.fromOption
performOther :: (Key -> Git.Repo -> FilePath) -> Key -> CommandPerform