From 521d01b2e013318813274b8e44247dfc530d0502 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 17 Feb 2020 01:51:49 -0500 Subject: 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 Tested-by: Mike Frysinger --- subcmds/sync.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'subcmds/sync.py') 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. p.add_option('-c', '--current-branch', dest='current_branch_only', action='store_true', help='fetch only current branch from server') + p.add_option('-v', '--verbose', + dest='output_mode', action='store_true', + help='show all sync output') p.add_option('-q', '--quiet', - dest='quiet', action='store_true', - help='be more quiet') + dest='output_mode', action='store_false', + help='only show errors') p.add_option('-j', '--jobs', dest='jobs', action='store', type='int', help="projects to fetch simultaneously (default %d)" % self.jobs) @@ -332,6 +335,7 @@ later is required to fix a server side protocol bug. try: success = project.Sync_NetworkHalf( quiet=opt.quiet, + verbose=opt.verbose, current_branch_only=opt.current_branch_only, force_sync=opt.force_sync, clone_bundle=not opt.no_clone_bundle, @@ -835,7 +839,7 @@ later is required to fix a server side protocol bug. """Fetch & update the local manifest project.""" if not opt.local_only: start = time.time() - success = mp.Sync_NetworkHalf(quiet=opt.quiet, + success = mp.Sync_NetworkHalf(quiet=opt.quiet, verbose=opt.verbose, current_branch_only=opt.current_branch_only, no_tags=opt.no_tags, optimized_fetch=opt.optimized_fetch, @@ -883,6 +887,9 @@ later is required to fix a server side protocol bug. soft_limit, _ = _rlimit_nofile() self.jobs = min(self.jobs, (soft_limit - 5) // 3) + opt.quiet = opt.output_mode is False + opt.verbose = opt.output_mode is True + if opt.manifest_name: self.manifest.Override(opt.manifest_name) -- cgit v1.2.3-54-g00ecf