diff options
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Drop.hs | 2 | ||||
-rw-r--r-- | Command/Fsck.hs | 2 | ||||
-rw-r--r-- | Command/Get.hs | 6 | ||||
-rw-r--r-- | Command/Info.hs | 1 | ||||
-rw-r--r-- | Command/MetaData.hs | 2 | ||||
-rw-r--r-- | Command/Mirror.hs | 7 | ||||
-rw-r--r-- | Command/Move.hs | 8 | ||||
-rw-r--r-- | Command/RecvKey.hs | 2 | ||||
-rw-r--r-- | Command/TransferInfo.hs | 1 | ||||
-rw-r--r-- | Command/Whereis.hs | 2 |
10 files changed, 20 insertions, 13 deletions
diff --git a/Command/Drop.hs b/Command/Drop.hs index 79797ab02..129dce035 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -41,7 +41,7 @@ optParser desc = DropOptions <$> cmdParams desc <*> optional parseDropFromOption <*> parseAutoOption - <*> optional (parseKeyOptions False) + <*> optional parseKeyOptions <*> parseBatchOption parseDropFromOption :: Parser (DeferredParse Remote) diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 4972be649..b37a26e12 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -66,7 +66,7 @@ optParser desc = FsckOptions <> completeRemotes )) <*> optional parseincremental - <*> optional (parseKeyOptions False) + <*> optional parseKeyOptions where parseincremental = flag' StartIncrementalO diff --git a/Command/Get.hs b/Command/Get.hs index 3f461fa04..bd4891b92 100644 --- a/Command/Get.hs +++ b/Command/Get.hs @@ -14,6 +14,7 @@ import Annex.Transfer import Annex.NumCopies import Annex.Wanted import qualified Command.Move +import Types.ActionItem cmd :: Command cmd = withGlobalOptions (jobsOption : jsonOption : annexedMatchingOptions) $ @@ -34,7 +35,7 @@ optParser desc = GetOptions <$> cmdParams desc <*> optional parseFromOption <*> parseAutoOption - <*> optional (parseKeyOptions True) + <*> optional (parseIncompleteOption <|> parseKeyOptions <|> parseFailedTransfersOption) <*> parseBatchOption seek :: GetOptions -> CommandSeek @@ -57,7 +58,8 @@ start o from file key = start' expensivecheck from key afile (mkActionItem afile | otherwise = return True startKeys :: Maybe Remote -> Key -> ActionItem -> CommandStart -startKeys from key = start' (return True) from key Nothing +startKeys from key ai = checkFailedTransferDirection ai Download $ + start' (return True) from key Nothing ai start' :: Annex Bool -> Maybe Remote -> Key -> AssociatedFile -> ActionItem -> CommandStart start' expensivecheck from key afile ai = stopUnless (not <$> inAnnex key) $ diff --git a/Command/Info.hs b/Command/Info.hs index 39511e6d4..f8a13eb1c 100644 --- a/Command/Info.hs +++ b/Command/Info.hs @@ -32,6 +32,7 @@ import Remote import Config import Git.Config (boolConfig) import Utility.Percentage +import Types.Transfer import Logs.Transfer import Types.TrustLevel import Types.FileMatcher diff --git a/Command/MetaData.hs b/Command/MetaData.hs index 4233c56a7..e3cf921cb 100644 --- a/Command/MetaData.hs +++ b/Command/MetaData.hs @@ -40,7 +40,7 @@ optParser :: CmdParamsDesc -> Parser MetaDataOptions optParser desc = MetaDataOptions <$> cmdParams desc <*> ((Get <$> getopt) <|> (Set <$> some modopts) <|> pure GetAll) - <*> optional (parseKeyOptions False) + <*> optional parseKeyOptions <*> parseBatchOption where getopt = option (eitherReader mkMetaField) diff --git a/Command/Mirror.hs b/Command/Mirror.hs index 50aca0338..1c7b6e396 100644 --- a/Command/Mirror.hs +++ b/Command/Mirror.hs @@ -14,6 +14,7 @@ import qualified Command.Get import qualified Remote import Annex.Content import Annex.NumCopies +import Types.Transfer cmd :: Command cmd = withGlobalOptions ([jobsOption] ++ annexedMatchingOptions) $ @@ -31,7 +32,7 @@ optParser :: CmdParamsDesc -> Parser MirrorOptions optParser desc = MirrorOptions <$> cmdParams desc <*> parseFromToOptions - <*> optional (parseKeyOptions False) + <*> optional (parseKeyOptions <|> parseFailedTransfersOption) instance DeferredParseClass MirrorOptions where finishParse v = MirrorOptions @@ -53,13 +54,13 @@ start o file k = startKey o afile k (mkActionItem afile) startKey :: MirrorOptions -> Maybe FilePath -> Key -> ActionItem -> CommandStart startKey o afile key ai = case fromToOptions o of - ToRemote r -> ifM (inAnnex key) + ToRemote r -> checkFailedTransferDirection ai Upload $ ifM (inAnnex key) ( Command.Move.toStart False afile key ai =<< getParsed r , do numcopies <- getnumcopies Command.Drop.startRemote afile ai numcopies key =<< getParsed r ) - FromRemote r -> do + FromRemote r -> checkFailedTransferDirection ai Download $ do haskey <- flip Remote.hasKey key =<< getParsed r case haskey of Left _ -> stop diff --git a/Command/Move.hs b/Command/Move.hs index 88ca4e01d..bf2aa0a24 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -35,7 +35,7 @@ optParser :: CmdParamsDesc -> Parser MoveOptions optParser desc = MoveOptions <$> cmdParams desc <*> parseFromToOptions - <*> optional (parseKeyOptions False) + <*> optional (parseKeyOptions <|> parseFailedTransfersOption) instance DeferredParseClass MoveOptions where finishParse v = MoveOptions @@ -61,8 +61,10 @@ startKey o move = start' o move Nothing start' :: MoveOptions -> Bool -> AssociatedFile -> Key -> ActionItem -> CommandStart start' o move afile key ai = case fromToOptions o of - FromRemote src -> fromStart move afile key ai =<< getParsed src - ToRemote dest -> toStart move afile key ai =<< getParsed dest + FromRemote src -> checkFailedTransferDirection ai Download $ + fromStart move afile key ai =<< getParsed src + ToRemote dest -> checkFailedTransferDirection ai Upload $ + toStart move afile key ai =<< getParsed dest showMoveAction :: Bool -> Key -> ActionItem -> Annex () showMoveAction move = showStart' (if move then "move" else "copy") diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs index 5bd2d8b59..103db559b 100644 --- a/Command/RecvKey.hs +++ b/Command/RecvKey.hs @@ -12,7 +12,7 @@ import Annex.Content import Annex.Action import Annex import Utility.Rsync -import Logs.Transfer +import Types.Transfer import Command.SendKey (fieldTransfer) import qualified CmdLine.GitAnnexShell.Fields as Fields diff --git a/Command/TransferInfo.hs b/Command/TransferInfo.hs index 4db3f8de3..21b7830c3 100644 --- a/Command/TransferInfo.hs +++ b/Command/TransferInfo.hs @@ -9,6 +9,7 @@ module Command.TransferInfo where import Command import Annex.Content +import Types.Transfer import Logs.Transfer import qualified CmdLine.GitAnnexShell.Fields as Fields import Utility.Metered diff --git a/Command/Whereis.hs b/Command/Whereis.hs index b91c31ca1..3a21e0a3b 100644 --- a/Command/Whereis.hs +++ b/Command/Whereis.hs @@ -31,7 +31,7 @@ data WhereisOptions = WhereisOptions optParser :: CmdParamsDesc -> Parser WhereisOptions optParser desc = WhereisOptions <$> cmdParams desc - <*> optional (parseKeyOptions False) + <*> optional parseKeyOptions <*> parseBatchOption seek :: WhereisOptions -> CommandSeek |