diff options
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 |