summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-09-20 12:56:17 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-09-20 12:58:23 -0400
commit7fa114e629fe33822763f376ac57b0efd48d5686 (patch)
tree50a434e59f3cb029b929accb9bb9664e8be98f88 /Command
parentfe0f83542373e9b42be6f201919a902bfe3095b6 (diff)
update transfer info and notify when exporting
Same as is done for all other transfers of content, so the webapp will display progress bars etc. This commit was sponsored by Anthony DeRobertis on Patreon.
Diffstat (limited to 'Command')
-rw-r--r--Command/Export.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/Command/Export.hs b/Command/Export.hs
index f2bbcaf01..dfa452956 100644
--- a/Command/Export.hs
+++ b/Command/Export.hs
@@ -22,6 +22,7 @@ import Types.Remote
import Types.Export
import Annex.Export
import Annex.Content
+import Annex.Transfer
import Annex.CatFile
import Annex.LockFile
import Logs.Location
@@ -30,6 +31,7 @@ import Database.Export
import Messages.Progress
import Config
import Utility.Tmp
+import Utility.Metered
import qualified Data.ByteString.Lazy as L
import qualified Data.Map as M
@@ -202,21 +204,25 @@ startExport r ea db cvar ti = do
stopUnless (liftIO $ notElem loc <$> getExportedLocation db (asKey ek)) $ do
showStart ("export " ++ name r) f
liftIO $ modifyMVar_ cvar (pure . const True)
- next $ performExport r ea db ek (Git.LsTree.sha ti) loc
+ next $ performExport r ea db ek af (Git.LsTree.sha ti) loc
where
loc = mkExportLocation f
- f = getTopFilePath $ Git.LsTree.file ti
+ f = getTopFilePath (Git.LsTree.file ti)
+ af = AssociatedFile (Just f)
-performExport :: Remote -> ExportActions Annex -> ExportHandle -> ExportKey -> Sha -> ExportLocation -> CommandPerform
-performExport r ea db ek contentsha loc = do
+performExport :: Remote -> ExportActions Annex -> ExportHandle -> ExportKey -> AssociatedFile -> Sha -> ExportLocation -> CommandPerform
+performExport r ea db ek af contentsha loc = do
let storer = storeExport ea
sent <- case ek of
AnnexKey k -> ifM (inAnnex k)
( metered Nothing k $ \m -> do
let rollback = void $
performUnexport r ea db [ek] loc
- sendAnnex k rollback
- (\f -> storer f k loc m)
+ notifyTransfer Upload af $
+ upload (uuid r) k af noRetry $ \pm -> do
+ let m' = combineMeterUpdate pm m
+ sendAnnex k rollback
+ (\f -> storer f k loc m')
, do
showNote "not available"
return False