get, move, copy, mirror: Added --failed switch which retries failed copies/moves

Note that get --from foo --failed will get things that a previous get --from bar
tried and failed to get, etc. I considered making --failed only retry
transfers from the same remote, but it was easier, and seems more useful,
to not have the same remote requirement.

Noisy due to some refactoring into Types/
This commit is contained in:
Joey Hess 2016-08-03 12:37:12 -04:00
parent 0fc85c45b5
commit 1a0e2c9901
Failed to extract signature
53 changed files with 254 additions and 127 deletions

View file

@ -139,32 +139,37 @@ parseToOption = parseRemoteOption $ strOption
data KeyOptions
= WantAllKeys
| WantUnusedKeys
| WantFailedTransfers
| WantSpecificKey Key
| WantIncompleteKeys
| WantBranchKeys [Branch]
parseKeyOptions :: Bool -> Parser KeyOptions
parseKeyOptions allowincomplete = if allowincomplete
then base
<|> flag' WantIncompleteKeys
( long "incomplete"
<> help "resume previous downloads"
)
else base
where
base = parseAllOption
<|> WantBranchKeys <$> some (option (str >>= pure . Ref)
( long "branch" <> metavar paramRef
<> help "operate on files in the specified branch or treeish"
))
<|> flag' WantUnusedKeys
( long "unused" <> short 'U'
<> help "operate on files found by last run of git-annex unused"
)
<|> (WantSpecificKey <$> option (str >>= parseKey)
( long "key" <> metavar paramKey
<> help "operate on specified key"
))
parseKeyOptions :: Parser KeyOptions
parseKeyOptions = parseAllOption
<|> WantBranchKeys <$> some (option (str >>= pure . Ref)
( long "branch" <> metavar paramRef
<> help "operate on files in the specified branch or treeish"
))
<|> flag' WantUnusedKeys
( long "unused" <> short 'U'
<> help "operate on files found by last run of git-annex unused"
)
<|> (WantSpecificKey <$> option (str >>= parseKey)
( long "key" <> metavar paramKey
<> help "operate on specified key"
))
parseFailedTransfersOption :: Parser KeyOptions
parseFailedTransfersOption = flag' WantFailedTransfers
( long "failed"
<> help "operate on files that recently failed to be transferred"
)
parseIncompleteOption :: Parser KeyOptions
parseIncompleteOption = flag' WantIncompleteKeys
( long "incomplete"
<> help "resume previous downloads"
)
parseAllOption :: Parser KeyOptions
parseAllOption = flag' WantAllKeys