summaryrefslogtreecommitdiff
path: root/Command/SendKey.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-02 01:31:10 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-02 01:31:10 -0400
commitbea0ac0274861f639ef999b146a719f4300fbfe4 (patch)
treebd1bf0d171f83667da918850e6b653c288031d30 /Command/SendKey.hs
parentd1f49b0ad032f13adc39d963cc8ceca28215b1d5 (diff)
record transfers for git-annex-shell
Not yet tested and places git-annex-shell is run need to be modified to pass the new field settings. Note that rsyncServerSend was changed to fork, rather than directly exec rsync, because it needs to keep the transfer lock held, and clean up the transfer log when done.
Diffstat (limited to 'Command/SendKey.hs')
-rw-r--r--Command/SendKey.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/Command/SendKey.hs b/Command/SendKey.hs
index 686a31caa..5eca70d24 100644
--- a/Command/SendKey.hs
+++ b/Command/SendKey.hs
@@ -1,6 +1,6 @@
{- git-annex command
-
- - Copyright 2010 Joey Hess <joey@kitenet.net>
+ - Copyright 2010,2012 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -11,6 +11,7 @@ import Common.Annex
import Command
import Annex.Content
import Utility.RsyncFile
+import Logs.Transfer
def :: [Command]
def = [oneShot $ command "sendkey" paramKey seek
@@ -20,9 +21,12 @@ seek :: [CommandSeek]
seek = [withKeys start]
start :: Key -> CommandStart
-start key = do
- file <- inRepo $ gitAnnexLocation key
- whenM (inAnnex key) $
- liftIO $ rsyncServerSend file -- does not return
- warning "requested key is not present"
- liftIO exitFailure
+start key = ifM (inAnnex key)
+ ( fieldTransfer Upload key $ do
+ file <- inRepo $ gitAnnexLocation key
+ liftIO $ ifM (rsyncServerSend file)
+ ( exitSuccess , exitFailure )
+ , do
+ warning "requested key is not present"
+ liftIO exitFailure
+ )