remove "checking remotename" message

This fixes fsck of a remote that uses chunking displaying
(checking remotename) (checking remotename)" for every chunk.

Also, some remotes displayed the message, and others did not, with no
consistency. It was originally displayed only when accessing remotes
that were expensive or might involve a password prompt, I think, but
nothing in the API said when to do it so it became an inconsistent mess.

Originally I thought fsck should always display it. But it only displays
in fsck --from remote, so the user knows the remote is being accessed,
so there is no reason to tell them it's accessing it over and over.

It was also possible for git-annex move to sometimes display it twice,
due to checking if content is present twice. But, the user of move
specifies --from/--to, so it does not need to display when it's
accessing the remote, as the user expects it to access the remote.

git-annex get might display it, but only if the remote also supports
hasKeyCheap, which is really only local git remotes, which didn't
display it always; and in any case nothing displayed it before hasKeyCheap,
which is checked first, so I don't think this needs to display it ever.

mirror is like move. And that's all the main places it would have been
displayed.

This commit was sponsored by Jochen Bartl on Patreon.
This commit is contained in:
Joey Hess 2021-04-27 12:50:45 -04:00
parent f58fb5a610
commit f8836306fa
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
14 changed files with 36 additions and 66 deletions

View file

@ -15,7 +15,6 @@ import Types.Import
import qualified Git
import Config.Cost
import Remote.Helper.Special
import Remote.Helper.Messages
import Remote.Helper.ExportImport
import Annex.UUID
import Utility.Metered
@ -77,7 +76,7 @@ gen r u rc gc rs = do
, retrieveExport = retrieveExportM serial adir
, removeExport = removeExportM serial adir
, versionedExport = False
, checkPresentExport = checkPresentExportM this serial adir
, checkPresentExport = checkPresentExportM serial adir
, removeExportDirectory = Just $ removeExportDirectoryM serial adir
, renameExport = renameExportM serial adir
}
@ -115,7 +114,7 @@ gen r u rc gc rs = do
(store serial adir)
(retrieve serial adir)
(remove serial adir)
(checkKey this serial adir)
(checkKey serial adir)
this
where
adir = maybe (giveup "missing androiddirectory") AndroidPath
@ -214,12 +213,11 @@ remove' :: AndroidSerial -> AndroidPath -> Annex Bool
remove' serial aloc = adbShellBool serial
[Param "rm", Param "-f", File (fromAndroidPath aloc)]
checkKey :: Remote -> AndroidSerial -> AndroidPath -> CheckPresent
checkKey r serial adir k = checkKey' r serial (androidLocation adir k)
checkKey :: AndroidSerial -> AndroidPath -> CheckPresent
checkKey serial adir k = checkKey' serial (androidLocation adir k)
checkKey' :: Remote -> AndroidSerial -> AndroidPath -> Annex Bool
checkKey' r serial aloc = do
showChecking r
checkKey' :: AndroidSerial -> AndroidPath -> Annex Bool
checkKey' serial aloc = do
out <- adbShellRaw serial $ unwords
[ "if test -e ", shellEscape (fromAndroidPath aloc)
, "; then echo y"
@ -268,8 +266,8 @@ removeExportDirectoryM serial abase dir =
go = adbShellBool serial [Param "rm", Param "-rf", File (fromAndroidPath adir)]
adir = androidExportLocation abase (mkExportLocation (fromExportDirectory dir))
checkPresentExportM :: Remote -> AndroidSerial -> AndroidPath -> Key -> ExportLocation -> Annex Bool
checkPresentExportM r serial adir _k loc = checkKey' r serial aloc
checkPresentExportM :: AndroidSerial -> AndroidPath -> Key -> ExportLocation -> Annex Bool
checkPresentExportM serial adir _k loc = checkKey' serial aloc
where
aloc = androidExportLocation adir loc