diff options
| author | Mike Frysinger <vapier@google.com> | 2020-02-17 01:51:49 -0500 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2020-02-17 17:02:27 +0000 |
| commit | 521d01b2e013318813274b8e44247dfc530d0502 (patch) | |
| tree | 1cb60e7c0bf44904d85c985cbe31ec95a7232018 /subcmds | |
| parent | 2b1345b8c5e519ba7f3d7339dbb49f16fcd9239b (diff) | |
| download | git-repo-521d01b2e013318813274b8e44247dfc530d0502.tar.gz | |
sync: introduce --verbose option
This allows us to control sync output better by having three levels
of output: quiet (only errors), default (progress bars), verbose (all
the things). For now, we just put the chatty "already have persistent
ref" message behind the verbose level.
Bug: https://crbug.com/gerrit/11293
Change-Id: Ia61333fd8085719f3e99edb7b466cdb04031b67f
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255414
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/sync.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 3d42a0a7..cb285290 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -234,9 +234,12 @@ later is required to fix a server side protocol bug. | |||
| 234 | p.add_option('-c', '--current-branch', | 234 | p.add_option('-c', '--current-branch', |
| 235 | dest='current_branch_only', action='store_true', | 235 | dest='current_branch_only', action='store_true', |
| 236 | help='fetch only current branch from server') | 236 | help='fetch only current branch from server') |
| 237 | p.add_option('-v', '--verbose', | ||
| 238 | dest='output_mode', action='store_true', | ||
| 239 | help='show all sync output') | ||
| 237 | p.add_option('-q', '--quiet', | 240 | p.add_option('-q', '--quiet', |
| 238 | dest='quiet', action='store_true', | 241 | dest='output_mode', action='store_false', |
| 239 | help='be more quiet') | 242 | help='only show errors') |
| 240 | p.add_option('-j', '--jobs', | 243 | p.add_option('-j', '--jobs', |
| 241 | dest='jobs', action='store', type='int', | 244 | dest='jobs', action='store', type='int', |
| 242 | help="projects to fetch simultaneously (default %d)" % self.jobs) | 245 | help="projects to fetch simultaneously (default %d)" % self.jobs) |
| @@ -332,6 +335,7 @@ later is required to fix a server side protocol bug. | |||
| 332 | try: | 335 | try: |
| 333 | success = project.Sync_NetworkHalf( | 336 | success = project.Sync_NetworkHalf( |
| 334 | quiet=opt.quiet, | 337 | quiet=opt.quiet, |
| 338 | verbose=opt.verbose, | ||
| 335 | current_branch_only=opt.current_branch_only, | 339 | current_branch_only=opt.current_branch_only, |
| 336 | force_sync=opt.force_sync, | 340 | force_sync=opt.force_sync, |
| 337 | clone_bundle=not opt.no_clone_bundle, | 341 | clone_bundle=not opt.no_clone_bundle, |
| @@ -835,7 +839,7 @@ later is required to fix a server side protocol bug. | |||
| 835 | """Fetch & update the local manifest project.""" | 839 | """Fetch & update the local manifest project.""" |
| 836 | if not opt.local_only: | 840 | if not opt.local_only: |
| 837 | start = time.time() | 841 | start = time.time() |
| 838 | success = mp.Sync_NetworkHalf(quiet=opt.quiet, | 842 | success = mp.Sync_NetworkHalf(quiet=opt.quiet, verbose=opt.verbose, |
| 839 | current_branch_only=opt.current_branch_only, | 843 | current_branch_only=opt.current_branch_only, |
| 840 | no_tags=opt.no_tags, | 844 | no_tags=opt.no_tags, |
| 841 | optimized_fetch=opt.optimized_fetch, | 845 | optimized_fetch=opt.optimized_fetch, |
| @@ -883,6 +887,9 @@ later is required to fix a server side protocol bug. | |||
| 883 | soft_limit, _ = _rlimit_nofile() | 887 | soft_limit, _ = _rlimit_nofile() |
| 884 | self.jobs = min(self.jobs, (soft_limit - 5) // 3) | 888 | self.jobs = min(self.jobs, (soft_limit - 5) // 3) |
| 885 | 889 | ||
| 890 | opt.quiet = opt.output_mode is False | ||
| 891 | opt.verbose = opt.output_mode is True | ||
| 892 | |||
| 886 | if opt.manifest_name: | 893 | if opt.manifest_name: |
| 887 | self.manifest.Override(opt.manifest_name) | 894 | self.manifest.Override(opt.manifest_name) |
| 888 | 895 | ||
