Add progress display for transfers to/from external special remotes.

This commit is contained in:
Joey Hess 2014-02-10 21:33:22 -04:00
parent 408d0e6a45
commit e885080d06
2 changed files with 23 additions and 13 deletions

View file

@ -92,16 +92,18 @@ externalSetup mu c = do
store :: External -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
store external k _f p = sendAnnex k rollback $ \f ->
storeHelper external k f p
metered (Just p) k $
storeHelper external k f
where
rollback = void $ remove external k
storeEncrypted :: External -> [CommandParam] -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
storeEncrypted external gpgOpts (cipher, enck) k p = withTmp enck $ \tmp ->
sendAnnex k rollback $ \src -> do
liftIO $ encrypt gpgOpts cipher (feedFile src) $
readBytes $ L.writeFile tmp
storeHelper external enck tmp p
metered (Just p) k $ \meterupdate -> do
liftIO $ encrypt gpgOpts cipher (feedFile src) $
readBytes $ L.writeFile tmp
storeHelper external enck tmp meterupdate
where
rollback = void $ remove external enck
@ -118,17 +120,19 @@ storeHelper external k f p = safely $
_ -> Nothing
retrieve :: External -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex Bool
retrieve external k _f d p = retrieveHelper external k d p
retrieve external k _f d p = metered (Just p) k $
retrieveHelper external k d
retrieveEncrypted :: External -> (Cipher, Key) -> Key -> FilePath -> MeterUpdate -> Annex Bool
retrieveEncrypted external (cipher, enck) _ f p = withTmp enck $ \tmp ->
ifM (retrieveHelper external enck tmp p)
( liftIO $ catchBoolIO $ do
decrypt cipher (feedFile tmp) $
readBytes $ L.writeFile f
return True
, return False
)
retrieveEncrypted external (cipher, enck) k f p = withTmp enck $ \tmp ->
metered (Just p) k $ \meterupdate ->
ifM (retrieveHelper external enck tmp meterupdate)
( liftIO $ catchBoolIO $ do
decrypt cipher (feedFile tmp) $
readBytes $ L.writeFile f
return True
, return False
)
retrieveHelper :: External -> Key -> FilePath -> MeterUpdate -> Annex Bool
retrieveHelper external k d p = safely $

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
git-annex (5.20140211) UNRELEASED; urgency=medium
* Add progress display for transfers to/from external special remotes.
-- Joey Hess <joeyh@debian.org> Mon, 10 Feb 2014 21:33:03 -0400
git-annex (5.20140210) unstable; urgency=medium
* --in can now refer to files that were located in a repository at