fix nested progress meters when using git-annex-shell fallback
Caused an ugly blank line when the first progress meter was not used, but also it may have confused -J display.
This commit is contained in:
parent
7bed3927ba
commit
b96b845ffd
3 changed files with 21 additions and 23 deletions
|
@ -470,17 +470,16 @@ copyFromRemote' forcersync r (State connpool _) key file dest meterupdate
|
|||
file forwardRetry
|
||||
(\p -> copier object dest (combineMeterUpdate p meterupdate) checksuccess)
|
||||
| Git.repoIsSsh (repo r) = if forcersync
|
||||
then unVerified fallback
|
||||
then unVerified $ fallback meterupdate
|
||||
else P2PHelper.retrieve
|
||||
(Ssh.runProto r connpool False fallback)
|
||||
(\p -> Ssh.runProto r connpool False (fallback p))
|
||||
key file dest meterupdate
|
||||
| otherwise = giveup "copying from non-ssh, non-http remote not supported"
|
||||
where
|
||||
fallback = metered (Just meterupdate) key (return Nothing) $ \p ->
|
||||
feedprogressback $ \p' -> do
|
||||
oh <- mkOutputHandlerQuiet
|
||||
Ssh.rsyncHelper oh (Just (combineMeterUpdate p' p))
|
||||
=<< Ssh.rsyncParamsRemote False r Download key dest file
|
||||
fallback p = feedprogressback $ \p' -> do
|
||||
oh <- mkOutputHandlerQuiet
|
||||
Ssh.rsyncHelper oh (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
|
||||
|
@ -575,7 +574,7 @@ copyToRemote r (State connpool duc) key file meterupdate
|
|||
)
|
||||
| Git.repoIsSsh (repo r) = commitOnCleanup r $
|
||||
P2PHelper.store
|
||||
(Ssh.runProto r connpool False copyremotefallback)
|
||||
(\p -> Ssh.runProto r connpool False (copyremotefallback p))
|
||||
key file meterupdate
|
||||
|
||||
| otherwise = giveup "copying to non-ssh repo not supported"
|
||||
|
@ -602,15 +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 ->
|
||||
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
|
||||
oh <- mkOutputHandlerQuiet
|
||||
Ssh.rsyncHelper oh (Just p)
|
||||
=<< Ssh.rsyncParamsRemote unlocked r Upload key object file
|
||||
copyremotefallback p = 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
|
||||
oh <- mkOutputHandlerQuiet
|
||||
Ssh.rsyncHelper oh (Just p)
|
||||
=<< Ssh.rsyncParamsRemote unlocked r Upload key object file
|
||||
|
||||
fsckOnRemote :: Git.Repo -> [CommandParam] -> Annex (IO Bool)
|
||||
fsckOnRemote r params
|
||||
|
|
|
@ -30,17 +30,17 @@ type ProtoConnRunner c = forall a. P2P.Proto a -> ClosableConnection c -> Annex
|
|||
-- the pool when done.
|
||||
type WithConn a c = (ClosableConnection c -> Annex (ClosableConnection c, a)) -> Annex a
|
||||
|
||||
store :: ProtoRunner Bool -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
||||
store :: (MeterUpdate -> ProtoRunner Bool) -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
||||
store runner k af p = do
|
||||
let getsrcfile = fmap fst <$> prepSendAnnex k
|
||||
metered (Just p) k getsrcfile $ \p' ->
|
||||
fromMaybe False
|
||||
<$> runner (P2P.put k af p')
|
||||
<$> runner p' (P2P.put k af p')
|
||||
|
||||
retrieve :: ProtoRunner Bool -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex (Bool, Verification)
|
||||
retrieve :: (MeterUpdate -> ProtoRunner Bool) -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex (Bool, Verification)
|
||||
retrieve runner k af dest p = unVerified $
|
||||
metered (Just p) k (return Nothing) $ \p' -> fromMaybe False
|
||||
<$> runner (P2P.get dest k af p')
|
||||
<$> runner p (P2P.get dest k af p')
|
||||
|
||||
remove :: ProtoRunner Bool -> Key -> Annex Bool
|
||||
remove runner k = fromMaybe False <$> runner (P2P.remove k)
|
||||
|
|
|
@ -51,8 +51,8 @@ chainGen addr r u c gc = do
|
|||
{ uuid = u
|
||||
, cost = cst
|
||||
, name = Git.repoDescribe r
|
||||
, storeKey = store protorunner
|
||||
, retrieveKeyFile = retrieve protorunner
|
||||
, storeKey = store (const protorunner)
|
||||
, retrieveKeyFile = retrieve (const protorunner)
|
||||
, retrieveKeyFileCheap = \_ _ _ -> return False
|
||||
, removeKey = remove protorunner
|
||||
, lockContent = Just $ lock withconn runProtoConn u
|
||||
|
|
Loading…
Reference in a new issue