1
0
Fork 0

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:
Mike Frysinger 2021-02-16 01:43:31 -05:00
parent c5bbea8db3
commit 6a2400a4d0
5 changed files with 27 additions and 25 deletions

View file

@ -17,7 +17,7 @@ import glob
import multiprocessing
import os
from command import PagedCommand
from command import DEFAULT_LOCAL_JOBS, PagedCommand
from color import Coloring
import platform_utils
@ -76,11 +76,10 @@ the following meanings:
d: deleted ( in index, not in work tree )
"""
PARALLEL_JOBS = DEFAULT_LOCAL_JOBS
def _Options(self, p):
p.add_option('-j', '--jobs',
dest='jobs', action='store', type='int', default=2,
help="number of projects to check simultaneously")
super()._Options(p)
p.add_option('-o', '--orphans',
dest='orphans', action='store_true',
help="include objects in working directory outside of repo projects")