summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-04-13 14:57:40 -0400
committerMike Frysinger <vapier@google.com>2021-04-13 22:25:17 +0000
commit9180a07b8fb33d5ba0b82facf987b51ca7b15dc4 (patch)
tree4c815bea7136115bf382a1bb75b89b67bd39bd61 /subcmds/sync.py
parentf32f243ff8aaabe5287235015e1ce189da0123e3 (diff)
downloadgit-repo-9180a07b8fb33d5ba0b82facf987b51ca7b15dc4.tar.gz
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 <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py14
1 files changed, 3 insertions, 11 deletions
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.
167""" 167"""
168 PARALLEL_JOBS = 1 168 PARALLEL_JOBS = 1
169 169
170 def _Options(self, p, show_smart=True): 170 def _CommonOptions(self, p):
171 try: 171 try:
172 self.PARALLEL_JOBS = self.manifest.default.sync_j 172 self.PARALLEL_JOBS = self.manifest.default.sync_j
173 except ManifestParseError: 173 except ManifestParseError:
174 pass 174 pass
175 super()._Options(p) 175 super()._CommonOptions(p)
176 176
177 def _Options(self, p, show_smart=True):
177 p.add_option('--jobs-network', default=None, type=int, metavar='JOBS', 178 p.add_option('--jobs-network', default=None, type=int, metavar='JOBS',
178 help='number of network jobs to run in parallel (defaults to --jobs)') 179 help='number of network jobs to run in parallel (defaults to --jobs)')
179 p.add_option('--jobs-checkout', default=None, type=int, metavar='JOBS', 180 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.
211 p.add_option('-c', '--current-branch', 212 p.add_option('-c', '--current-branch',
212 dest='current_branch_only', action='store_true', 213 dest='current_branch_only', action='store_true',
213 help='fetch only current branch from server') 214 help='fetch only current branch from server')
214 p.add_option('-v', '--verbose',
215 dest='output_mode', action='store_true',
216 help='show all sync output')
217 p.add_option('-q', '--quiet',
218 dest='output_mode', action='store_false',
219 help='only show errors')
220 p.add_option('-m', '--manifest-name', 215 p.add_option('-m', '--manifest-name',
221 dest='manifest_name', 216 dest='manifest_name',
222 help='temporary manifest to use for this sync', metavar='NAME.xml') 217 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.
770 soft_limit, _ = _rlimit_nofile() 765 soft_limit, _ = _rlimit_nofile()
771 self.jobs = min(self.jobs, (soft_limit - 5) // 3) 766 self.jobs = min(self.jobs, (soft_limit - 5) // 3)
772 767
773 opt.quiet = opt.output_mode is False
774 opt.verbose = opt.output_mode is True
775
776 if opt.manifest_name: 768 if opt.manifest_name:
777 self.manifest.Override(opt.manifest_name) 769 self.manifest.Override(opt.manifest_name)
778 770