Bug 1413374 - [tryselect] Fix |mach try empty| regression and add a test, r?armenzg
MozReview-Commit-ID: Iv2RDqqhL57
--- 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":[]
+ }
+