From 9180a07b8fb33d5ba0b82facf987b51ca7b15dc4 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 13 Apr 2021 14:57:40 -0400 Subject: command: make --verbose/--quiet available to all subcommands Add new CommonOptions entry points to move the existing --jobs to, and relocate all --verbose/--quiet options to that. This provides both a consistent interface for users as well as for code. Change-Id: Ifaf83b88872421f4749b073c472b4a67ca6c0437 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303224 Reviewed-by: Raman Tenneti Tested-by: Mike Frysinger --- subcmds/sync.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'subcmds/sync.py') diff --git a/subcmds/sync.py b/subcmds/sync.py index b8abb1a7..e7079879 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py @@ -167,13 +167,14 @@ later is required to fix a server side protocol bug. """ PARALLEL_JOBS = 1 - def _Options(self, p, show_smart=True): + def _CommonOptions(self, p): try: self.PARALLEL_JOBS = self.manifest.default.sync_j except ManifestParseError: pass - super()._Options(p) + super()._CommonOptions(p) + def _Options(self, p, show_smart=True): p.add_option('--jobs-network', default=None, type=int, metavar='JOBS', help='number of network jobs to run in parallel (defaults to --jobs)') p.add_option('--jobs-checkout', default=None, type=int, metavar='JOBS', @@ -211,12 +212,6 @@ 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='output_mode', action='store_false', - help='only show errors') p.add_option('-m', '--manifest-name', dest='manifest_name', help='temporary manifest to use for this sync', metavar='NAME.xml') @@ -770,9 +765,6 @@ 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