mirror of
https://github.com/Dev-Wiki/git-repo.git
synced 2025-12-14 00:24:05 +08:00
command: unify --job option & default values
Extend the Command class to support adding the --jobs option to the parser if the command declares it supports running in parallel. Also pull the default value used for the number of local jobs into the command module so local commands can share it. Change-Id: I22b0f8d2cf69875013cec657b8e6c4385549ccac Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297024 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Chris Mcdonald <cjmcdonald@google.com>
This commit is contained in:
@@ -177,12 +177,14 @@ If the remote SSH daemon is Gerrit Code Review, version 2.0.10 or
|
||||
later is required to fix a server side protocol bug.
|
||||
|
||||
"""
|
||||
PARALLEL_JOBS = 1
|
||||
|
||||
def _Options(self, p, show_smart=True):
|
||||
try:
|
||||
self.jobs = self.manifest.default.sync_j
|
||||
self.PARALLEL_JOBS = self.manifest.default.sync_j
|
||||
except ManifestParseError:
|
||||
self.jobs = 1
|
||||
pass
|
||||
super()._Options(p)
|
||||
|
||||
p.add_option('-f', '--force-broken',
|
||||
dest='force_broken', action='store_true',
|
||||
@@ -222,9 +224,6 @@ later is required to fix a server side protocol bug.
|
||||
p.add_option('-q', '--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)
|
||||
p.add_option('-m', '--manifest-name',
|
||||
dest='manifest_name',
|
||||
help='temporary manifest to use for this sync', metavar='NAME.xml')
|
||||
|
||||
Reference in New Issue
Block a user