Bug 1413374 - [tryselect] Fix |mach try empty| regression and add a test, r?armenzg draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 01 Nov 2017 08:12:42 -0400
changeset 690059 4800997820e01eb2ada7ac51b9ca29ec0f8ceaf0
parent 690034 cd7217cf05a2332a8fd7b498767a07b2c31ea657
child 738472 083febf40d8f751c3dee25aa25ef844dbfd24225
push id87193
push userahalberstadt@mozilla.com
push dateWed, 01 Nov 2017 12:30:08 +0000
reviewersarmenzg
bugs1413374
milestone58.0a1
Bug 1413374 - [tryselect] Fix |mach try empty| regression and add a test, r?armenzg MozReview-Commit-ID: Iv2RDqqhL57
tools/tryselect/selectors/empty.py
tools/tryselect/test/cram.ini
tools/tryselect/test/test_empty.t
--- a/tools/tryselect/selectors/empty.py
+++ b/tools/tryselect/selectors/empty.py
@@ -3,17 +3,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 from ..cli import BaseTryParser
 from ..vcs import VCSHelper
 
 
-class SyntaxParser(BaseTryParser):
+class EmptyParser(BaseTryParser):
     name = 'empty'
     common_groups = ['push']
 
 
 def run_empty_try(message='{msg}', push=True, **kwargs):
     vcs = VCSHelper.create()
     msg = 'No try selector specified, use "Add New Jobs" to select tasks.'
     return vcs.push_to_try('empty', message.format(msg=msg), [], push=push,
--- a/tools/tryselect/test/cram.ini
+++ b/tools/tryselect/test/cram.ini
@@ -1,3 +1,4 @@
+[test_empty.t]
 [test_fuzzy.t]
 [test_message.t]
 [test_preset.t]
new file mode 100644
--- /dev/null
+++ b/tools/tryselect/test/test_empty.t
@@ -0,0 +1,35 @@
+  $ . $TESTDIR/setup.sh
+  $ cd $topsrcdir
+
+Test empty selector
+
+  $ ./mach try empty --no-push
+  Commit message:
+  No try selector specified, use "Add New Jobs" to select tasks.
+  
+  Pushed via `mach try empty`
+  Calculated try_task_config.json:
+  {
+    "tasks":[]
+  }
+  
+  $ ./mach try empty --no-push --closed-tree
+  Commit message:
+  No try selector specified, use "Add New Jobs" to select tasks. ON A CLOSED TREE
+  
+  Pushed via `mach try empty`
+  Calculated try_task_config.json:
+  {
+    "tasks":[]
+  }
+  
+  $ ./mach try empty --no-push --closed-tree -m "foo {msg} bar"
+  Commit message:
+  foo No try selector specified, use "Add New Jobs" to select tasks. bar ON A CLOSED TREE
+  
+  Pushed via `mach try empty`
+  Calculated try_task_config.json:
+  {
+    "tasks":[]
+  }
+