summaryrefslogtreecommitdiff
path: root/Command/Mirror.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-03-25 17:06:14 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-03-25 17:06:14 -0400
commit850241b7fed075c8a0055ae77cb30d6485aaa795 (patch)
treebbae2d577ea7daf136cfb80cdf87e4ce76681f84 /Command/Mirror.hs
parent644cd4ca27e410ca567ec0f78acf2517d91d330e (diff)
--auto is no longer a global option; only get, drop, and copy accept it.
Not a behavior change unless you were passing it to a command that ignored it.
Diffstat (limited to 'Command/Mirror.hs')
-rw-r--r--Command/Mirror.hs16
1 files changed, 7 insertions, 9 deletions
diff --git a/Command/Mirror.hs b/Command/Mirror.hs
index 7d3a7ef67..a04efb89b 100644
--- a/Command/Mirror.hs
+++ b/Command/Mirror.hs
@@ -14,19 +14,20 @@ import qualified Command.Drop
import qualified Command.Get
import qualified Remote
import Annex.Content
-import qualified Annex
import Config.NumCopies
cmd :: [Command]
-cmd = [withOptions (fromToOptions ++ annexedMatchingOptions ++ keyOptions) $
- command "mirror" paramPaths seek
- SectionCommon "mirror content of files to/from another repository"]
+cmd = [withOptions mirrorOptions $ command "mirror" paramPaths seek
+ SectionCommon "mirror content of files to/from another repository"]
+
+mirrorOptions :: [Option]
+mirrorOptions = fromToOptions ++ annexedMatchingOptions ++ keyOptions
seek :: CommandSeek
seek ps = do
to <- getOptionField toOption Remote.byNameWithUUID
from <- getOptionField fromOption Remote.byNameWithUUID
- withKeyOptions
+ withKeyOptions False
(startKey to from Nothing)
(withFilesInGit $ whenAnnexed $ start to from)
ps
@@ -35,16 +36,13 @@ start :: Maybe Remote -> Maybe Remote -> FilePath -> Key -> CommandStart
start to from file = startKey to from (Just file)
startKey :: Maybe Remote -> Maybe Remote -> Maybe FilePath -> Key -> CommandStart
-startKey to from afile key = do
- noAuto
+startKey to from afile key =
case (from, to) of
(Nothing, Nothing) -> error "specify either --from or --to"
(Nothing, Just r) -> mirrorto r
(Just r, Nothing) -> mirrorfrom r
_ -> error "only one of --from or --to can be specified"
where
- noAuto = whenM (Annex.getState Annex.auto) $
- error "--auto is not supported for mirror"
mirrorto r = ifM (inAnnex key)
( Command.Move.toStart r False afile key
, do