diff options
| author | Mike Frysinger <vapier@google.com> | 2021-04-13 15:07:21 -0400 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2021-04-13 22:25:26 +0000 |
| commit | 151701e85f0beb1a7c896eb82c0d1f55ee380567 (patch) | |
| tree | 7e86c0ff2835050abf73b62bac69390dfb67b8a6 /subcmds | |
| parent | 9180a07b8fb33d5ba0b82facf987b51ca7b15dc4 (diff) | |
| download | git-repo-151701e85f0beb1a7c896eb82c0d1f55ee380567.tar.gz | |
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>
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/abandon.py | 2 | ||||
| -rw-r--r-- | subcmds/checkout.py | 2 | ||||
| -rw-r--r-- | subcmds/start.py | 4 | ||||
| -rw-r--r-- | subcmds/sync.py | 6 |
4 files changed, 7 insertions, 7 deletions
diff --git a/subcmds/abandon.py b/subcmds/abandon.py index ea3f4ed0..1d22917e 100644 --- a/subcmds/abandon.py +++ b/subcmds/abandon.py | |||
| @@ -81,7 +81,7 @@ It is equivalent to "git branch -D <branchname>". | |||
| 81 | err[branch].append(project) | 81 | err[branch].append(project) |
| 82 | pm.update() | 82 | pm.update() |
| 83 | 83 | ||
| 84 | pm = Progress('Abandon %s' % nb, len(all_projects)) | 84 | pm = Progress('Abandon %s' % nb, len(all_projects), quiet=opt.quiet) |
| 85 | # NB: Multiprocessing is heavy, so don't spin it up for one job. | 85 | # NB: Multiprocessing is heavy, so don't spin it up for one job. |
| 86 | if len(all_projects) == 1 or opt.jobs == 1: | 86 | if len(all_projects) == 1 or opt.jobs == 1: |
| 87 | _ProcessResults(self._ExecuteOne(opt, nb, x) for x in all_projects) | 87 | _ProcessResults(self._ExecuteOne(opt, nb, x) for x in all_projects) |
diff --git a/subcmds/checkout.py b/subcmds/checkout.py index cf54ced7..6b71a8fa 100644 --- a/subcmds/checkout.py +++ b/subcmds/checkout.py | |||
| @@ -59,7 +59,7 @@ The command is equivalent to: | |||
| 59 | err.append(project) | 59 | err.append(project) |
| 60 | pm.update() | 60 | pm.update() |
| 61 | 61 | ||
| 62 | pm = Progress('Checkout %s' % nb, len(all_projects)) | 62 | pm = Progress('Checkout %s' % nb, len(all_projects), quiet=opt.quiet) |
| 63 | # NB: Multiprocessing is heavy, so don't spin it up for one job. | 63 | # NB: Multiprocessing is heavy, so don't spin it up for one job. |
| 64 | if len(all_projects) == 1 or opt.jobs == 1: | 64 | if len(all_projects) == 1 or opt.jobs == 1: |
| 65 | _ProcessResults(self._ExecuteOne(nb, x) for x in all_projects) | 65 | _ProcessResults(self._ExecuteOne(nb, x) for x in all_projects) |
diff --git a/subcmds/start.py b/subcmds/start.py index 2593ace6..aa2f915a 100644 --- a/subcmds/start.py +++ b/subcmds/start.py | |||
| @@ -106,7 +106,7 @@ revision specified in the manifest. | |||
| 106 | if not os.path.exists(os.getcwd()): | 106 | if not os.path.exists(os.getcwd()): |
| 107 | os.chdir(self.manifest.topdir) | 107 | os.chdir(self.manifest.topdir) |
| 108 | 108 | ||
| 109 | pm = Progress('Syncing %s' % nb, len(all_projects)) | 109 | pm = Progress('Syncing %s' % nb, len(all_projects), quiet=opt.quiet) |
| 110 | for project in all_projects: | 110 | for project in all_projects: |
| 111 | gitc_project = self.gitc_manifest.paths[project.relpath] | 111 | gitc_project = self.gitc_manifest.paths[project.relpath] |
| 112 | # Sync projects that have not been opened. | 112 | # Sync projects that have not been opened. |
| @@ -129,7 +129,7 @@ revision specified in the manifest. | |||
| 129 | err.append(project) | 129 | err.append(project) |
| 130 | pm.update() | 130 | pm.update() |
| 131 | 131 | ||
| 132 | pm = Progress('Starting %s' % nb, len(all_projects)) | 132 | pm = Progress('Starting %s' % nb, len(all_projects), quiet=opt.quiet) |
| 133 | # NB: Multiprocessing is heavy, so don't spin it up for one job. | 133 | # NB: Multiprocessing is heavy, so don't spin it up for one job. |
| 134 | if len(all_projects) == 1 or opt.jobs == 1: | 134 | if len(all_projects) == 1 or opt.jobs == 1: |
| 135 | _ProcessResults(self._ExecuteOne(opt, nb, x) for x in all_projects) | 135 | _ProcessResults(self._ExecuteOne(opt, nb, x) for x in all_projects) |
diff --git a/subcmds/sync.py b/subcmds/sync.py index e7079879..21166af5 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -367,7 +367,7 @@ later is required to fix a server side protocol bug. | |||
| 367 | 367 | ||
| 368 | jobs = opt.jobs_network if opt.jobs_network else self.jobs | 368 | jobs = opt.jobs_network if opt.jobs_network else self.jobs |
| 369 | fetched = set() | 369 | fetched = set() |
| 370 | pm = Progress('Fetching', len(projects), delay=False) | 370 | pm = Progress('Fetching', len(projects), delay=False, quiet=opt.quiet) |
| 371 | 371 | ||
| 372 | objdir_project_map = dict() | 372 | objdir_project_map = dict() |
| 373 | for project in projects: | 373 | for project in projects: |
| @@ -470,7 +470,7 @@ later is required to fix a server side protocol bug. | |||
| 470 | # Only checkout projects with worktrees. | 470 | # Only checkout projects with worktrees. |
| 471 | all_projects = [x for x in all_projects if x.worktree] | 471 | all_projects = [x for x in all_projects if x.worktree] |
| 472 | 472 | ||
| 473 | pm = Progress('Checking out', len(all_projects)) | 473 | pm = Progress('Checking out', len(all_projects), quiet=opt.quiet) |
| 474 | 474 | ||
| 475 | def _ProcessResults(results): | 475 | def _ProcessResults(results): |
| 476 | for (success, project, start, finish) in results: | 476 | for (success, project, start, finish) in results: |
| @@ -504,7 +504,7 @@ later is required to fix a server side protocol bug. | |||
| 504 | return ret and not err_results | 504 | return ret and not err_results |
| 505 | 505 | ||
| 506 | def _GCProjects(self, projects, opt, err_event): | 506 | def _GCProjects(self, projects, opt, err_event): |
| 507 | pm = Progress('Garbage collecting', len(projects), delay=False) | 507 | pm = Progress('Garbage collecting', len(projects), delay=False, quiet=opt.quiet) |
| 508 | pm.update(inc=0, msg='prescan') | 508 | pm.update(inc=0, msg='prescan') |
| 509 | 509 | ||
| 510 | gc_gitdirs = {} | 510 | gc_gitdirs = {} |
