Bug 1236382 - Add commonly used arguments to mach try, remove the extra arguments functionality. r=jgraham
Using nargs='*' in conjunction with nargs=REMAINDER creates an ambiguity when the argument using nargs='*' is optional, it is not specified, and the user intends their arguments to be interpreted as "extra" arguments. This commit removes the nargs=REMAINDER argument for mach_try, and implements its most common users from trychooser as a set of regular arguments to echo to generated try syntax. MozReview-Commit-ID: FOuDZxUfHu9
This commit is contained in:
@@ -502,6 +502,7 @@ class PushToTry(MachCommandBase):
|
||||
return rv
|
||||
|
||||
def validate_args(self, **kwargs):
|
||||
from autotry import AutoTry
|
||||
if not kwargs["paths"] and not kwargs["tests"] and not kwargs["tags"]:
|
||||
print("Paths, tags, or tests must be specified as an argument to autotry.")
|
||||
sys.exit(1)
|
||||
@@ -552,7 +553,11 @@ class PushToTry(MachCommandBase):
|
||||
print("Error parsing --tags argument:\n%s" % e.message)
|
||||
sys.exit(1)
|
||||
|
||||
return kwargs["builds"], platforms, tests, talos, paths, tags, kwargs["extra_args"]
|
||||
extra_values = {k['dest'] for k in AutoTry.pass_through_arguments.values()}
|
||||
extra_args = {k: v for k, v in kwargs.items()
|
||||
if k in extra_values and v}
|
||||
|
||||
return kwargs["builds"], platforms, tests, talos, paths, tags, extra_args
|
||||
|
||||
|
||||
@Command('try',
|
||||
@@ -632,7 +637,7 @@ class PushToTry(MachCommandBase):
|
||||
if not any(kwargs[item] for item in ("paths", "tests", "tags")):
|
||||
kwargs["paths"], kwargs["tags"] = at.find_paths_and_tags(kwargs["verbose"])
|
||||
|
||||
builds, platforms, tests, talos, paths, tags, extra_args = self.validate_args(**kwargs)
|
||||
builds, platforms, tests, talos, paths, tags, extra = self.validate_args(**kwargs)
|
||||
|
||||
if paths or tags:
|
||||
driver = self._spawn(BuildDriver)
|
||||
@@ -654,7 +659,7 @@ class PushToTry(MachCommandBase):
|
||||
|
||||
try:
|
||||
msg = at.calc_try_syntax(platforms, tests, talos, builds, paths_by_flavor, tags,
|
||||
extra_args, kwargs["intersection"])
|
||||
extra, kwargs["intersection"])
|
||||
except ValueError as e:
|
||||
print(e.message)
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user