Display progress bar when getting files from export remotes
And moved the progress bar display into storeExport as well. This commit was sponsored by John Pellman on Patreon.
This commit is contained in:
parent
4f50a21137
commit
7b9701675e
3 changed files with 13 additions and 7 deletions
|
@ -8,6 +8,7 @@ git-annex (7.20190130) UNRELEASED; urgency=medium
|
||||||
This allows downloads of files that were exported to such a remote
|
This allows downloads of files that were exported to such a remote
|
||||||
before versioning was enabled on it.
|
before versioning was enabled on it.
|
||||||
* Improved speed of S3 remote by only loading S3 creds once.
|
* Improved speed of S3 remote by only loading S3 creds once.
|
||||||
|
* Display progress bar when getting files from export remotes.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 30 Jan 2019 12:30:22 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 30 Jan 2019 12:30:22 -0400
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ import Annex.LockFile
|
||||||
import Logs.Location
|
import Logs.Location
|
||||||
import Logs.Export
|
import Logs.Export
|
||||||
import Database.Export
|
import Database.Export
|
||||||
import Messages.Progress
|
|
||||||
import Config
|
import Config
|
||||||
import Utility.Tmp
|
import Utility.Tmp
|
||||||
import Utility.Metered
|
import Utility.Metered
|
||||||
|
@ -233,20 +232,18 @@ performExport r db ek af contentsha loc = do
|
||||||
let rollback = void $
|
let rollback = void $
|
||||||
performUnexport r db [ek] loc
|
performUnexport r db [ek] loc
|
||||||
sendAnnex k rollback $ \f ->
|
sendAnnex k rollback $ \f ->
|
||||||
metered Nothing k (return $ Just f) $ \_ m -> do
|
storer f k loc pm
|
||||||
let m' = combineMeterUpdate pm m
|
|
||||||
storer f k loc m'
|
|
||||||
, do
|
, do
|
||||||
showNote "not available"
|
showNote "not available"
|
||||||
return False
|
return False
|
||||||
)
|
)
|
||||||
-- Sending a non-annexed file.
|
-- Sending a non-annexed file.
|
||||||
GitKey sha1k -> metered Nothing sha1k (return Nothing) $ \_ m ->
|
GitKey sha1k ->
|
||||||
withTmpFile "export" $ \tmp h -> do
|
withTmpFile "export" $ \tmp h -> do
|
||||||
b <- catObject contentsha
|
b <- catObject contentsha
|
||||||
liftIO $ L.hPut h b
|
liftIO $ L.hPut h b
|
||||||
liftIO $ hClose h
|
liftIO $ hClose h
|
||||||
storer tmp sha1k loc m
|
storer tmp sha1k loc nullMeterUpdate
|
||||||
if sent
|
if sent
|
||||||
then next $ cleanupExport r db ek loc True
|
then next $ cleanupExport r db ek loc True
|
||||||
else stop
|
else stop
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{- helpers for special remotes
|
{- helpers for special remotes
|
||||||
-
|
-
|
||||||
- Copyright 2011-2018 Joey Hess <id@joeyh.name>
|
- Copyright 2011-2019 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU GPL version 3 or higher.
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -157,6 +157,8 @@ specialRemoteCfg c = SpecialRemoteCfg (getChunkConfig c) True
|
||||||
|
|
||||||
-- Modifies a base Remote to support both chunking and encryption,
|
-- Modifies a base Remote to support both chunking and encryption,
|
||||||
-- which special remotes typically should support.
|
-- which special remotes typically should support.
|
||||||
|
--
|
||||||
|
-- Handles progress displays when displayProgress is set.
|
||||||
specialRemote :: RemoteModifier
|
specialRemote :: RemoteModifier
|
||||||
specialRemote c = specialRemote' (specialRemoteCfg c) c
|
specialRemote c = specialRemote' (specialRemoteCfg c) c
|
||||||
|
|
||||||
|
@ -192,6 +194,12 @@ specialRemote' cfg c preparestorer prepareretriever prepareremover preparecheckp
|
||||||
, whereisKey = if noChunks (chunkConfig cfg) && not isencrypted
|
, whereisKey = if noChunks (chunkConfig cfg) && not isencrypted
|
||||||
then whereisKey baser
|
then whereisKey baser
|
||||||
else Nothing
|
else Nothing
|
||||||
|
, exportActions = (exportActions baser)
|
||||||
|
{ storeExport = \f k l p -> displayprogress p k (Just f) $
|
||||||
|
storeExport (exportActions baser) f k l
|
||||||
|
, retrieveExport = \k l f p -> displayprogress p k Nothing $
|
||||||
|
retrieveExport (exportActions baser) k l f
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cip = cipherKey c (gitconfig baser)
|
cip = cipherKey c (gitconfig baser)
|
||||||
isencrypted = isJust (extractCipher c)
|
isencrypted = isJust (extractCipher c)
|
||||||
|
|
Loading…
Reference in a new issue