summaryrefslogtreecommitdiff
path: root/Logs/Transfer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Logs/Transfer.hs')
-rw-r--r--Logs/Transfer.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs
index 526241f93..658e18b5d 100644
--- a/Logs/Transfer.hs
+++ b/Logs/Transfer.hs
@@ -10,6 +10,7 @@ module Logs.Transfer where
import Common.Annex
import Annex.Perms
import Annex.Exception
+import qualified Annex
import qualified Git
import Types.Remote
@@ -54,6 +55,12 @@ upload u key file a = transfer (Transfer Upload u key) file a
download :: UUID -> Key -> AssociatedFile -> Annex a -> Annex a
download u key file a = transfer (Transfer Download u key) file a
+fieldTransfer :: Direction -> Key -> Annex a -> Annex a
+fieldTransfer direction key a = do
+ afile <- Annex.getField "associatedfile"
+ maybe a (\u -> transfer (Transfer direction (toUUID u) key) afile a)
+ =<< Annex.getField "remoteuuid"
+
{- Runs a transfer action. Creates and locks the transfer information file
- while the action is running. Will throw an error if the transfer is
- already in progress.