diff options
author | Joey Hess <joey@kitenet.net> | 2012-08-23 15:22:23 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-08-23 15:24:15 -0400 |
commit | 715a9a2f8e788ffe0bc92bc02919a1825bda49a7 (patch) | |
tree | 259e5e683f7d7db3f6bba0192638fe77eeb36d05 /Command/SendKey.hs | |
parent | 487bdf0e24d34135da2e53bbcd2c97d892ed817a (diff) |
keep logs of failed transfers, and requeue them when doing a non-full scan
of a remote
Diffstat (limited to 'Command/SendKey.hs')
-rw-r--r-- | Command/SendKey.hs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Command/SendKey.hs b/Command/SendKey.hs index 5eca70d24..8f914b5ed 100644 --- a/Command/SendKey.hs +++ b/Command/SendKey.hs @@ -12,6 +12,7 @@ import Command import Annex.Content import Utility.RsyncFile import Logs.Transfer +import qualified Fields def :: [Command] def = [oneShot $ command "sendkey" paramKey seek @@ -24,9 +25,17 @@ start :: Key -> CommandStart start key = ifM (inAnnex key) ( fieldTransfer Upload key $ do file <- inRepo $ gitAnnexLocation key - liftIO $ ifM (rsyncServerSend file) - ( exitSuccess , exitFailure ) + liftIO $ rsyncServerSend file , do warning "requested key is not present" liftIO exitFailure ) + +fieldTransfer :: Direction -> Key -> Annex Bool -> CommandStart +fieldTransfer direction key a = do + afile <- Fields.getField Fields.associatedFile + ok <- maybe a (\u -> runTransfer (Transfer direction (toUUID u) key) afile a) + =<< Fields.getField Fields.remoteUUID + if ok + then liftIO exitSuccess + else liftIO exitFailure |