Bug 1406777 - Support --message and --no-push with |mach try empty|, r?KWierso draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 11 Oct 2017 15:45:08 -0400
changeset 678719 1c4de6b8b1bafa6f36ec9aef61a378b052819f03
parent 678653 5cc87630fff42a8cb272ec58c530ef68007ecacd
child 735415 bbb5e1432a0fe893fab8d0bb7aca3b305bd2a77b
push id84016
push userahalberstadt@mozilla.com
push dateWed, 11 Oct 2017 19:49:30 +0000
reviewersKWierso
bugs1406777
milestone58.0a1
Bug 1406777 - Support --message and --no-push with |mach try empty|, r?KWierso 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
tools/tryselect/mach_commands.py
tools/tryselect/selectors/empty.py
--- a/tools/tryselect/mach_commands.py
+++ b/tools/tryselect/mach_commands.py
@@ -33,19 +33,23 @@ def syntax_parser():
     return parser
 
 
 def fuzzy_parser():
     from tryselect.selectors.fuzzy import FuzzyParser
     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
 
 
 @SettingsProvider
 class TryConfig(object):
 
     @classmethod
@@ -139,28 +143,29 @@ class TrySelect(MachCommandBase):
 
           ^start 'exact | !ignore fuzzy end$
         """
         from tryselect.selectors.fuzzy import run_fuzzy_try
         return run_fuzzy_try(**kwargs)
 
     @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
         your patches to try, running no builds or tests by default. After
         the push finishes, you can manually add desired jobs to your push
         via Treeherder's Add New Jobs feature, located in the per-push
         menu.
         """
         from tryselect.selectors.empty import run_empty_try
-        return run_empty_try()
+        return run_empty_try(**kwargs)
 
     @SubCommand('try',
                 'syntax',
                 description='Select tasks on try using try syntax',
                 parser=syntax_parser)
     def try_syntax(self, **kwargs):
         """Push the current tree to try, with the specified syntax.
 
--- a/tools/tryselect/selectors/empty.py
+++ b/tools/tryselect/selectors/empty.py
@@ -2,11 +2,12 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 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)