From 7532e51ef944d3e95f5bb754bc65639acc9ae05d Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Wed, 11 Oct 2017 15:45:08 -0400 Subject: [PATCH] Bug 1406777 - Support --message and --no-push with |mach try empty|, r=armenzg This adds all the common arguments to |mach try empty|, including preset arguments which will just be ignored if specified. The commit message can be changed with: ./mach try empty -m DONTBUILD MozReview-Commit-ID: 5RYfLBOIX1g --HG-- extra : rebase_source : 412cbc50c2901a97893779a73a7f70d5ee6e2d72 --- tools/tryselect/mach_commands.py | 15 ++++++++++----- tools/tryselect/selectors/empty.py | 5 +++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/tryselect/mach_commands.py b/tools/tryselect/mach_commands.py index 4bf51d0e6683..2c5c23dd7019 100644 --- a/tools/tryselect/mach_commands.py +++ b/tools/tryselect/mach_commands.py @@ -38,9 +38,13 @@ def fuzzy_parser(): return FuzzyParser() -def generic_parser(): +def base_parser(): from tryselect.cli import BaseTryParser - parser = BaseTryParser() + return BaseTryParser() + + +def generic_parser(): + parser = base_parser() parser.add_argument('argv', nargs=argparse.REMAINDER) return parser @@ -144,8 +148,9 @@ class TrySelect(MachCommandBase): @SubCommand('try', 'empty', - description='Push to try without scheduling any tasks.') - def try_empty(self): + description='Push to try without scheduling any tasks.', + parser=base_parser) + def try_empty(self, **kwargs): """Push to try, running no builds or tests This selector does not prompt you to run anything, it just pushes @@ -155,7 +160,7 @@ class TrySelect(MachCommandBase): menu. """ from tryselect.selectors.empty import run_empty_try - return run_empty_try() + return run_empty_try(**kwargs) @SubCommand('try', 'syntax', diff --git a/tools/tryselect/selectors/empty.py b/tools/tryselect/selectors/empty.py index a4a8ddd183f7..34d662e528cb 100644 --- a/tools/tryselect/selectors/empty.py +++ b/tools/tryselect/selectors/empty.py @@ -7,6 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals from ..vcs import VCSHelper -def run_empty_try(): +def run_empty_try(message='{msg}', push=True, **kwargs): vcs = VCSHelper.create() - return vcs.push_to_try("empty", "", []) + msg = 'No try selector specified, use "Add New Jobs" to select tasks.' + return vcs.push_to_try('empty', message.format(msg=msg), [], push=push)