diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-03 12:37:12 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-03 12:37:12 -0400 |
commit | 508517de485e77196a8d8e33558f4185c50dea96 (patch) | |
tree | 319fc6e63da144e40dd124a07f4bb6c0ad25c5ee /Command.hs | |
parent | 019733f00d01301d71acc46245d2dc130934d951 (diff) |
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/
Diffstat (limited to 'Command.hs')
-rw-r--r-- | Command.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Command.hs b/Command.hs index 82c8b3cc1..4ffc7c319 100644 --- a/Command.hs +++ b/Command.hs @@ -1,6 +1,6 @@ {- git-annex command infrastructure - - - Copyright 2010-2015 Joey Hess <id@joeyh.name> + - Copyright 2010-2016 Joey Hess <id@joeyh.name> - - Licensed under the GNU GPL version 3 or higher. -} @@ -26,6 +26,8 @@ import qualified Git import Annex.Init import Config import Utility.Daemon +import Types.Transfer +import Types.ActionItem {- Generates a normal Command -} command :: String -> CommandSection -> String -> CmdParamsDesc -> (CmdParamsDesc -> CommandParser) -> Command @@ -91,6 +93,15 @@ stop = return Nothing stopUnless :: Annex Bool -> Annex (Maybe a) -> Annex (Maybe a) stopUnless c a = ifM c ( a , stop ) +{- When acting on a failed transfer, stops unless it was in the specified + - direction. -} +checkFailedTransferDirection :: ActionItem -> Direction -> Annex (Maybe a) -> Annex (Maybe a) +checkFailedTransferDirection ai d = stopUnless (pure check) + where + check = case actionItemTransferDirection ai of + Nothing -> True + Just d' -> d' == d + commonChecks :: [CommandCheck] commonChecks = [repoExists] |