fix lost metering for fallback rsyncs
08814327ff
accidentially got rid of it,
when it removed commandMetered.
This commit is contained in:
parent
abe8346dca
commit
cb05ef06bf
3 changed files with 27 additions and 19 deletions
|
@ -85,12 +85,11 @@ meteredFile file combinemeterupdate key a =
|
||||||
then metered combinemeterupdate key (return Nothing) $ \p ->
|
then metered combinemeterupdate key (return Nothing) $ \p ->
|
||||||
watchFileSize file p a
|
watchFileSize file p a
|
||||||
else a
|
else a
|
||||||
|
where
|
||||||
needOutputMeter :: MessageState -> Bool
|
needOutputMeter s = case outputType s of
|
||||||
needOutputMeter s = case outputType s of
|
JSONOutput jsonoptions -> jsonProgress jsonoptions
|
||||||
JSONOutput jsonoptions -> jsonProgress jsonoptions
|
NormalOutput | concurrentOutputEnabled s -> True
|
||||||
NormalOutput | concurrentOutputEnabled s -> True
|
_ -> False
|
||||||
_ -> False
|
|
||||||
|
|
||||||
{- Progress dots. -}
|
{- Progress dots. -}
|
||||||
showProgressDots :: Annex ()
|
showProgressDots :: Annex ()
|
||||||
|
@ -117,6 +116,11 @@ mkOutputHandler = OutputHandler
|
||||||
<$> commandProgressDisabled
|
<$> commandProgressDisabled
|
||||||
<*> mkStderrEmitter
|
<*> mkStderrEmitter
|
||||||
|
|
||||||
|
mkOutputHandlerQuiet :: Annex OutputHandler
|
||||||
|
mkOutputHandlerQuiet = OutputHandler
|
||||||
|
<$> pure True
|
||||||
|
<*> mkStderrEmitter
|
||||||
|
|
||||||
mkStderrRelayer :: Annex (Handle -> IO ())
|
mkStderrRelayer :: Annex (Handle -> IO ())
|
||||||
mkStderrRelayer = do
|
mkStderrRelayer = do
|
||||||
quiet <- commandProgressDisabled
|
quiet <- commandProgressDisabled
|
||||||
|
|
|
@ -60,6 +60,7 @@ import Annex.Path
|
||||||
import Creds
|
import Creds
|
||||||
import Types.NumCopies
|
import Types.NumCopies
|
||||||
import Annex.Action
|
import Annex.Action
|
||||||
|
import Messages.Progress
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import Control.Concurrent.MSampleVar
|
import Control.Concurrent.MSampleVar
|
||||||
|
@ -475,9 +476,10 @@ copyFromRemote' forcersync r (State connpool _) key file dest meterupdate
|
||||||
key file dest meterupdate
|
key file dest meterupdate
|
||||||
| otherwise = giveup "copying from non-ssh, non-http remote not supported"
|
| otherwise = giveup "copying from non-ssh, non-http remote not supported"
|
||||||
where
|
where
|
||||||
fallback = feedprogressback $ \p -> do
|
fallback = metered (Just meterupdate) key (return Nothing) $ \p ->
|
||||||
Ssh.rsyncHelper (Just (combineMeterUpdate meterupdate p))
|
feedprogressback $ \p' -> do
|
||||||
=<< Ssh.rsyncParamsRemote False r Download key dest file
|
Ssh.rsyncHelper (Just (combineMeterUpdate p' p))
|
||||||
|
=<< Ssh.rsyncParamsRemote False r Download key dest file
|
||||||
{- Feed local rsync's progress info back to the remote,
|
{- Feed local rsync's progress info back to the remote,
|
||||||
- by forking a feeder thread that runs
|
- by forking a feeder thread that runs
|
||||||
- git-annex-shell transferinfo at the same time
|
- git-annex-shell transferinfo at the same time
|
||||||
|
@ -599,13 +601,14 @@ copyToRemote r (State connpool duc) key file meterupdate
|
||||||
Annex.Content.getViaTmp verify key
|
Annex.Content.getViaTmp verify key
|
||||||
(\dest -> copier object dest p' (liftIO checksuccessio))
|
(\dest -> copier object dest p' (liftIO checksuccessio))
|
||||||
)
|
)
|
||||||
copyremotefallback = Annex.Content.sendAnnex key noop $ \object -> do
|
copyremotefallback = Annex.Content.sendAnnex key noop $ \object ->
|
||||||
-- This is too broad really, but recvkey normally
|
metered (Just meterupdate) key (return $ Just object) $ \p -> do
|
||||||
-- verifies content anyway, so avoid complicating
|
-- This is too broad really, but recvkey normally
|
||||||
-- it with a local sendAnnex check and rollback.
|
-- verifies content anyway, so avoid complicating
|
||||||
unlocked <- isDirect <||> versionSupportsUnlockedPointers
|
-- it with a local sendAnnex check and rollback.
|
||||||
Ssh.rsyncHelper (Just meterupdate)
|
unlocked <- isDirect <||> versionSupportsUnlockedPointers
|
||||||
=<< Ssh.rsyncParamsRemote unlocked r Upload key object file
|
Ssh.rsyncHelper (Just p)
|
||||||
|
=<< Ssh.rsyncParamsRemote unlocked r Upload key object file
|
||||||
|
|
||||||
fsckOnRemote :: Git.Repo -> [CommandParam] -> Annex (IO Bool)
|
fsckOnRemote :: Git.Repo -> [CommandParam] -> Annex (IO Bool)
|
||||||
fsckOnRemote r params
|
fsckOnRemote r params
|
||||||
|
|
|
@ -113,11 +113,12 @@ dropKey r key = onRemote NoConsumeStdin r (boolSystem, return False) "dropkey"
|
||||||
|
|
||||||
rsyncHelper :: Maybe MeterUpdate -> [CommandParam] -> Annex Bool
|
rsyncHelper :: Maybe MeterUpdate -> [CommandParam] -> Annex Bool
|
||||||
rsyncHelper m params = do
|
rsyncHelper m params = do
|
||||||
showOutput -- make way for progress bar
|
|
||||||
a <- case m of
|
a <- case m of
|
||||||
Nothing -> return $ rsync params
|
Nothing -> do
|
||||||
|
showOutput -- make way for progress bar
|
||||||
|
return $ rsync params
|
||||||
Just meter -> do
|
Just meter -> do
|
||||||
oh <- mkOutputHandler
|
oh <- mkOutputHandlerQuiet
|
||||||
return $ rsyncProgress oh meter params
|
return $ rsyncProgress oh meter params
|
||||||
ifM (liftIO a)
|
ifM (liftIO a)
|
||||||
( return True
|
( return True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue