progress: hide progress bar when --quiet

We want progress bars in the default output mode, but not when the
user specifies --quiet.  Add a setting to the Progress bar class so
it takes care of not displaying anything itself rather than having
to update every subcommand to conditionally setup & call the object.

Change-Id: I1134993bffc5437bc22e26be11a512125f10597f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303225
Reviewed-by: Raman Tenneti <rtenneti@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger
2021-04-13 15:07:21 -04:00
parent 9180a07b8f
commit 151701e85f
5 changed files with 16 additions and 8 deletions

View File

@@ -367,7 +367,7 @@ later is required to fix a server side protocol bug.
jobs = opt.jobs_network if opt.jobs_network else self.jobs
fetched = set()
pm = Progress('Fetching', len(projects), delay=False)
pm = Progress('Fetching', len(projects), delay=False, quiet=opt.quiet)
objdir_project_map = dict()
for project in projects:
@@ -470,7 +470,7 @@ later is required to fix a server side protocol bug.
# Only checkout projects with worktrees.
all_projects = [x for x in all_projects if x.worktree]
pm = Progress('Checking out', len(all_projects))
pm = Progress('Checking out', len(all_projects), quiet=opt.quiet)
def _ProcessResults(results):
for (success, project, start, finish) in results:
@@ -504,7 +504,7 @@ later is required to fix a server side protocol bug.
return ret and not err_results
def _GCProjects(self, projects, opt, err_event):
pm = Progress('Garbage collecting', len(projects), delay=False)
pm = Progress('Garbage collecting', len(projects), delay=False, quiet=opt.quiet)
pm.update(inc=0, msg='prescan')
gc_gitdirs = {}