diff options
author | Joey Hess <joey@kitenet.net> | 2014-01-21 17:08:49 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-01-21 17:25:39 -0400 |
commit | d44bd607d4fd18eadabe3c7693ebcf1c74aae63e (patch) | |
tree | 83e8867f45199ece960fc67e4d31f1d9b4a5d56a /Command/Mirror.hs | |
parent | d5f7fb27aad3e2e9c4bebb9ccd5577af8deb25c7 (diff) |
numcopies cleanup, part 2
This includes several bug fixes.
Diffstat (limited to 'Command/Mirror.hs')
-rw-r--r-- | Command/Mirror.hs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Command/Mirror.hs b/Command/Mirror.hs index e5ce33ec0..fb06ed2b4 100644 --- a/Command/Mirror.hs +++ b/Command/Mirror.hs @@ -28,17 +28,15 @@ seek ps = do to <- getOptionField toOption Remote.byNameWithUUID from <- getOptionField fromOption Remote.byNameWithUUID withKeyOptions - (startKey Nothing to from Nothing) + (startKey to from Nothing) (withFilesInGit $ whenAnnexed $ start to from) ps start :: Maybe Remote -> Maybe Remote -> FilePath -> (Key, Backend) -> CommandStart -start to from file (key, _backend) = do - numcopies <- getFileNumCopies file - startKey numcopies to from (Just file) key +start to from file (key, _backend) = startKey to from (Just file) key -startKey :: Maybe NumCopies -> Maybe Remote -> Maybe Remote -> Maybe FilePath -> Key -> CommandStart -startKey numcopies to from afile key = do +startKey :: Maybe Remote -> Maybe Remote -> Maybe FilePath -> Key -> CommandStart +startKey to from afile key = do noAuto case (from, to) of (Nothing, Nothing) -> error "specify either --from or --to" @@ -50,7 +48,9 @@ startKey numcopies to from afile key = do error "--auto is not supported for mirror" mirrorto r = ifM (inAnnex key) ( Command.Move.toStart r False afile key - , Command.Drop.startRemote afile numcopies key r + , do + numcopies <- getnumcopies + Command.Drop.startRemote afile numcopies key r ) mirrorfrom r = do haskey <- Remote.hasKey r key @@ -58,6 +58,9 @@ startKey numcopies to from afile key = do Left _ -> stop Right True -> Command.Get.start' (return True) Nothing key afile Right False -> ifM (inAnnex key) - ( Command.Drop.startLocal afile numcopies key Nothing + ( do + numcopies <- getnumcopies + Command.Drop.startLocal afile numcopies key Nothing , stop ) + getnumcopies = maybe getNumCopies getFileNumCopies afile |