aboutsummaryrefslogtreecommitdiff
path: root/Remote/Git.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Remote/Git.hs')
-rw-r--r--Remote/Git.hs27
1 files changed, 18 insertions, 9 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 4804cb10e..170c6fbf6 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -52,6 +52,7 @@ import qualified Remote.GCrypt
import Annex.Path
import Creds
import Annex.CatFile
+import Messages.Progress
import Control.Concurrent
import Control.Concurrent.MSampleVar
@@ -355,9 +356,11 @@ dropKey r key
{- Tries to copy a key's content from a remote's annex to a file. -}
copyFromRemote :: Remote -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex Bool
-copyFromRemote r key file dest _p = copyFromRemote' r key file dest
-copyFromRemote' :: Remote -> Key -> AssociatedFile -> FilePath -> Annex Bool
-copyFromRemote' r key file dest
+copyFromRemote r key file dest p = parallelMetered (Just p) key file $
+ copyFromRemote' r key file dest
+
+copyFromRemote' :: Remote -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex Bool
+copyFromRemote' r key file dest meterupdate
| not $ Git.repoIsUrl (repo r) = guardUsable (repo r) (return False) $ do
params <- Ssh.rsyncParams r Download
u <- getUUID
@@ -435,7 +438,9 @@ copyFromRemote' r key file dest
send bytes
forever $
send =<< readSV v
- let feeder = writeSV v . fromBytesProcessed
+ let feeder = \n -> do
+ meterupdate n
+ writeSV v (fromBytesProcessed n)
let cleanup = do
void $ tryIO $ killThread tid
tryNonAsync $
@@ -443,9 +448,9 @@ copyFromRemote' r key file dest
=<< tryTakeMVar pidv
bracketIO noop (const cleanup) (const $ a feeder)
-copyFromRemoteCheap :: Remote -> Key -> FilePath -> Annex Bool
+copyFromRemoteCheap :: Remote -> Key -> AssociatedFile -> FilePath -> Annex Bool
#ifndef mingw32_HOST_OS
-copyFromRemoteCheap r key file
+copyFromRemoteCheap r key af file
| not $ Git.repoIsUrl (repo r) = guardUsable (repo r) (return False) $ liftIO $ do
loc <- gitAnnexLocation key (repo r) $
fromJust $ remoteGitConfig $ gitconfig r
@@ -459,17 +464,21 @@ copyFromRemoteCheap r key file
)
| Git.repoIsSsh (repo r) =
ifM (Annex.Content.preseedTmp key file)
- ( copyFromRemote' r key Nothing file
+ ( parallelMetered Nothing key af $
+ copyFromRemote' r key af file
, return False
)
| otherwise = return False
#else
-copyFromRemoteCheap _ _ _ = return False
+copyFromRemoteCheap _ _ _ _ = return False
#endif
{- Tries to copy a key's content to a remote's annex. -}
copyToRemote :: Remote -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
-copyToRemote r key file p
+copyToRemote r key file p = parallelMetered (Just p) key file $ copyToRemote' r key file
+
+copyToRemote' :: Remote -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
+copyToRemote' r key file p
| not $ Git.repoIsUrl (repo r) =
guardUsable (repo r) (return False) $ commitOnCleanup r $
copylocal =<< Annex.Content.prepSendAnnex key