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 ->
|
||||
watchFileSize file p a
|
||||
else a
|
||||
|
||||
needOutputMeter :: MessageState -> Bool
|
||||
needOutputMeter s = case outputType s of
|
||||
JSONOutput jsonoptions -> jsonProgress jsonoptions
|
||||
NormalOutput | concurrentOutputEnabled s -> True
|
||||
_ -> False
|
||||
where
|
||||
needOutputMeter s = case outputType s of
|
||||
JSONOutput jsonoptions -> jsonProgress jsonoptions
|
||||
NormalOutput | concurrentOutputEnabled s -> True
|
||||
_ -> False
|
||||
|
||||
{- Progress dots. -}
|
||||
showProgressDots :: Annex ()
|
||||
|
@ -117,6 +116,11 @@ mkOutputHandler = OutputHandler
|
|||
<$> commandProgressDisabled
|
||||
<*> mkStderrEmitter
|
||||
|
||||
mkOutputHandlerQuiet :: Annex OutputHandler
|
||||
mkOutputHandlerQuiet = OutputHandler
|
||||
<$> pure True
|
||||
<*> mkStderrEmitter
|
||||
|
||||
mkStderrRelayer :: Annex (Handle -> IO ())
|
||||
mkStderrRelayer = do
|
||||
quiet <- commandProgressDisabled
|
||||
|
|
|
@ -60,6 +60,7 @@ import Annex.Path
|
|||
import Creds
|
||||
import Types.NumCopies
|
||||
import Annex.Action
|
||||
import Messages.Progress
|
||||
|
||||
import Control.Concurrent
|
||||
import Control.Concurrent.MSampleVar
|
||||
|
@ -475,9 +476,10 @@ copyFromRemote' forcersync r (State connpool _) key file dest meterupdate
|
|||
key file dest meterupdate
|
||||
| otherwise = giveup "copying from non-ssh, non-http remote not supported"
|
||||
where
|
||||
fallback = feedprogressback $ \p -> do
|
||||
Ssh.rsyncHelper (Just (combineMeterUpdate meterupdate p))
|
||||
=<< Ssh.rsyncParamsRemote False r Download key dest file
|
||||
fallback = metered (Just meterupdate) key (return Nothing) $ \p ->
|
||||
feedprogressback $ \p' -> do
|
||||
Ssh.rsyncHelper (Just (combineMeterUpdate p' p))
|
||||
=<< Ssh.rsyncParamsRemote False r Download key dest file
|
||||
{- Feed local rsync's progress info back to the remote,
|
||||
- by forking a feeder thread that runs
|
||||
- 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
|
||||
(\dest -> copier object dest p' (liftIO checksuccessio))
|
||||
)
|
||||
copyremotefallback = Annex.Content.sendAnnex key noop $ \object -> do
|
||||
-- This is too broad really, but recvkey normally
|
||||
-- verifies content anyway, so avoid complicating
|
||||
-- it with a local sendAnnex check and rollback.
|
||||
unlocked <- isDirect <||> versionSupportsUnlockedPointers
|
||||
Ssh.rsyncHelper (Just meterupdate)
|
||||
=<< Ssh.rsyncParamsRemote unlocked r Upload key object file
|
||||
copyremotefallback = Annex.Content.sendAnnex key noop $ \object ->
|
||||
metered (Just meterupdate) key (return $ Just object) $ \p -> do
|
||||
-- This is too broad really, but recvkey normally
|
||||
-- verifies content anyway, so avoid complicating
|
||||
-- it with a local sendAnnex check and rollback.
|
||||
unlocked <- isDirect <||> versionSupportsUnlockedPointers
|
||||
Ssh.rsyncHelper (Just p)
|
||||
=<< Ssh.rsyncParamsRemote unlocked r Upload key object file
|
||||
|
||||
fsckOnRemote :: Git.Repo -> [CommandParam] -> Annex (IO Bool)
|
||||
fsckOnRemote r params
|
||||
|
|
|
@ -113,11 +113,12 @@ dropKey r key = onRemote NoConsumeStdin r (boolSystem, return False) "dropkey"
|
|||
|
||||
rsyncHelper :: Maybe MeterUpdate -> [CommandParam] -> Annex Bool
|
||||
rsyncHelper m params = do
|
||||
showOutput -- make way for progress bar
|
||||
a <- case m of
|
||||
Nothing -> return $ rsync params
|
||||
Nothing -> do
|
||||
showOutput -- make way for progress bar
|
||||
return $ rsync params
|
||||
Just meter -> do
|
||||
oh <- mkOutputHandler
|
||||
oh <- mkOutputHandlerQuiet
|
||||
return $ rsyncProgress oh meter params
|
||||
ifM (liftIO a)
|
||||
( return True
|
||||
|
|
Loading…
Add table
Reference in a new issue