From 7fa114e629fe33822763f376ac57b0efd48d5686 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 20 Sep 2017 12:56:17 -0400 Subject: 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. --- Command/Export.hs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'Command') 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 -- cgit v1.2.3