Clean up remaining repo sync log spam.

There are still some verbose messages (e.g. "remote: ...") when doing
repo sync after a couple days. Let's hide them behind verbose flag.

Bug: N/A
Test: repo sync
Change-Id: I1408472c95ed80d9555adfe8f92211245c03cf41
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/400855
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Tested-by: Tomasz Wasilczyk <twasilczyk@google.com>
Commit-Queue: Tomasz Wasilczyk <twasilczyk@google.com>
This commit is contained in:
Tomasz Wasilczyk 2024-01-05 12:23:10 -08:00 committed by LUCI
parent 138c8a9ff5
commit 208f344950
2 changed files with 23 additions and 18 deletions

View File

@ -1636,9 +1636,9 @@ class Project:
elif pub == head: elif pub == head:
# All published commits are merged, and thus we are a # All published commits are merged, and thus we are a
# strict subset. We can fast-forward safely. # strict subset. We can fast-forward safely.
syncbuf.later1(self, _doff) syncbuf.later1(self, _doff, not verbose)
if submodules: if submodules:
syncbuf.later1(self, _dosubmodules) syncbuf.later1(self, _dosubmodules, not verbose)
return return
# Examine the local commits not in the remote. Find the # Examine the local commits not in the remote. Find the
@ -1697,10 +1697,10 @@ class Project:
def _dorebase(): def _dorebase():
self._Rebase(upstream="%s^1" % last_mine, onto=revid) self._Rebase(upstream="%s^1" % last_mine, onto=revid)
syncbuf.later2(self, _dorebase) syncbuf.later2(self, _dorebase, not verbose)
if submodules: if submodules:
syncbuf.later2(self, _dosubmodules) syncbuf.later2(self, _dosubmodules, not verbose)
syncbuf.later2(self, _docopyandlink) syncbuf.later2(self, _docopyandlink, not verbose)
elif local_changes: elif local_changes:
try: try:
self._ResetHard(revid) self._ResetHard(revid)
@ -1711,9 +1711,9 @@ class Project:
fail(e) fail(e)
return return
else: else:
syncbuf.later1(self, _doff) syncbuf.later1(self, _doff, not verbose)
if submodules: if submodules:
syncbuf.later1(self, _dosubmodules) syncbuf.later1(self, _dosubmodules, not verbose)
def AddCopyFile(self, src, dest, topdir): def AddCopyFile(self, src, dest, topdir):
"""Mark |src| for copying to |dest| (relative to |topdir|). """Mark |src| for copying to |dest| (relative to |topdir|).
@ -2883,10 +2883,12 @@ class Project:
if GitCommand(self, cmd).Wait() != 0: if GitCommand(self, cmd).Wait() != 0:
raise GitError(f"{self.name} rebase {upstream} ", project=self.name) raise GitError(f"{self.name} rebase {upstream} ", project=self.name)
def _FastForward(self, head, ffonly=False): def _FastForward(self, head, ffonly=False, quiet=True):
cmd = ["merge", "--no-stat", head] cmd = ["merge", "--no-stat", head]
if ffonly: if ffonly:
cmd.append("--ff-only") cmd.append("--ff-only")
if quiet:
cmd.append("-q")
if GitCommand(self, cmd).Wait() != 0: if GitCommand(self, cmd).Wait() != 0:
raise GitError(f"{self.name} merge {head} ", project=self.name) raise GitError(f"{self.name} merge {head} ", project=self.name)
@ -3759,17 +3761,20 @@ class _Failure:
class _Later: class _Later:
def __init__(self, project, action): def __init__(self, project, action, quiet):
self.project = project self.project = project
self.action = action self.action = action
self.quiet = quiet
def Run(self, syncbuf): def Run(self, syncbuf):
out = syncbuf.out out = syncbuf.out
out.project("project %s/", self.project.RelPath(local=False)) if not self.quiet:
out.nl() out.project("project %s/", self.project.RelPath(local=False))
out.nl()
try: try:
self.action() self.action()
out.nl() if not self.quiet:
out.nl()
return True return True
except GitError: except GitError:
out.nl() out.nl()
@ -3805,11 +3810,11 @@ class SyncBuffer:
self._failures.append(_Failure(project, err)) self._failures.append(_Failure(project, err))
self._MarkUnclean() self._MarkUnclean()
def later1(self, project, what): def later1(self, project, what, quiet):
self._later_queue1.append(_Later(project, what)) self._later_queue1.append(_Later(project, what, quiet))
def later2(self, project, what): def later2(self, project, what, quiet):
self._later_queue2.append(_Later(project, what)) self._later_queue2.append(_Later(project, what, quiet))
def Finish(self): def Finish(self):
self._PrintMessages() self._PrintMessages()

View File

@ -618,7 +618,7 @@ later is required to fix a server side protocol bug.
if not use_super: if not use_super:
continue continue
m.superproject.SetQuiet(opt.quiet) m.superproject.SetQuiet(not opt.verbose)
print_messages = git_superproject.PrintMessages( print_messages = git_superproject.PrintMessages(
opt.use_superproject, m opt.use_superproject, m
) )
@ -1501,7 +1501,7 @@ later is required to fix a server side protocol bug.
buf = TeeStringIO(sys.stdout) buf = TeeStringIO(sys.stdout)
try: try:
result = mp.Sync_NetworkHalf( result = mp.Sync_NetworkHalf(
quiet=opt.quiet, quiet=not opt.verbose,
output_redir=buf, output_redir=buf,
verbose=opt.verbose, verbose=opt.verbose,
current_branch_only=self._GetCurrentBranchOnly( current_branch_only=self._GetCurrentBranchOnly(