mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-02 16:14:25 +00:00
forall: move nested func out to the class
This is in preparation for simplifying the jobs support. The nested function is referenced in the options object which can't be pickled, so pull it out into a static method instead. Change-Id: I01d3c4eaabcb8b8775ddf22312a6e142c84cb77d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/298722 Reviewed-by: Michael Mortensen <mmortensen@google.com> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
31fabeed54
commit
179a242caa
@ -115,13 +115,15 @@ without iterating through the remaining projects.
|
|||||||
"""
|
"""
|
||||||
PARALLEL_JOBS = DEFAULT_LOCAL_JOBS
|
PARALLEL_JOBS = DEFAULT_LOCAL_JOBS
|
||||||
|
|
||||||
def _Options(self, p):
|
@staticmethod
|
||||||
super()._Options(p)
|
def _cmd_option(option, _opt_str, _value, parser):
|
||||||
|
|
||||||
def cmd(option, opt_str, value, parser):
|
|
||||||
setattr(parser.values, option.dest, list(parser.rargs))
|
setattr(parser.values, option.dest, list(parser.rargs))
|
||||||
while parser.rargs:
|
while parser.rargs:
|
||||||
del parser.rargs[0]
|
del parser.rargs[0]
|
||||||
|
|
||||||
|
def _Options(self, p):
|
||||||
|
super()._Options(p)
|
||||||
|
|
||||||
p.add_option('-r', '--regex',
|
p.add_option('-r', '--regex',
|
||||||
dest='regex', action='store_true',
|
dest='regex', action='store_true',
|
||||||
help="Execute the command only on projects matching regex or wildcard expression")
|
help="Execute the command only on projects matching regex or wildcard expression")
|
||||||
@ -136,7 +138,7 @@ without iterating through the remaining projects.
|
|||||||
help='Command (and arguments) to execute',
|
help='Command (and arguments) to execute',
|
||||||
dest='command',
|
dest='command',
|
||||||
action='callback',
|
action='callback',
|
||||||
callback=cmd)
|
callback=self._cmd_option)
|
||||||
p.add_option('-e', '--abort-on-errors',
|
p.add_option('-e', '--abort-on-errors',
|
||||||
dest='abort_on_errors', action='store_true',
|
dest='abort_on_errors', action='store_true',
|
||||||
help='Abort if a command exits unsuccessfully')
|
help='Abort if a command exits unsuccessfully')
|
||||||
|
Loading…
Reference in New Issue
Block a user