Bug 1400429 - Advertise use of `mach try` in commit message; r=ahal

This will allow us to inspect Try pushes to see how many are using
`mach try`.

The commit message for `mach try fuzzy` already advertised its usage.
We tweak the syntax a little so it isn't redundant.

MozReview-Commit-ID: 6kmYRKp0ffF

--HG--
extra : rebase_source : 9dd7caa5404ba235e6a4071802000b8bb740a6b7
This commit is contained in:
Gregory Szorc 2017-09-15 16:17:37 -07:00
Родитель 23f8a46b2c
Коммит 8f958c2424
5 изменённых файлов: 63 добавлений и 7 удалений

Просмотреть файл

@ -247,5 +247,5 @@ def run_fuzzy_try(update=False, query=None, templates=None, full=False, paramete
pset.save('fuzzy', save, query)
query = " with query: {}".format(query) if query else ""
msg = "Pushed via 'mach try fuzzy'{}".format(query)
return vcs.push_to_try(msg, selected, templates, push=push)
msg = "Fuzzy{}".format(query)
return vcs.push_to_try('fuzzy', msg, selected, templates, push=push)

Просмотреть файл

@ -451,8 +451,7 @@ class AutoTry(object):
if action in ('store_true', 'store_false'):
parts.append(arg)
try_syntax = " ".join(parts)
return try_syntax
return " ".join(parts)
def find_paths_and_tags(self, verbose):
paths, tags = set(), set()
@ -632,7 +631,7 @@ class AutoTry(object):
if kwargs["verbose"]:
print('The following try syntax was calculated:\n%s' % msg)
self.vcs.push_to_try(msg, push=kwargs['push'])
self.vcs.push_to_try('syntax', msg, push=kwargs['push'])
if kwargs["save"]:
assert msg.startswith("try: ")

Просмотреть файл

@ -12,6 +12,10 @@ Test fuzzy selector
]
}
Commit message:
Fuzzy with query: 'foo
Pushed via `mach try fuzzy`
$ ./mach try fuzzy $testargs -q "'bar"
no tasks selected
$ ./mach try fuzzy $testargs --full -q "'bar"
@ -23,6 +27,10 @@ Test fuzzy selector
]
}
Commit message:
Fuzzy with query: 'bar
Pushed via `mach try fuzzy`
Test templates
@ -40,6 +48,10 @@ Test templates
]
}
Commit message:
Fuzzy with query: 'foo
Pushed via `mach try fuzzy`
$ ./mach try fuzzy $testargs --env FOO=1 --env BAR=baz -q "'foo"
Calculated try selector:
{
@ -55,3 +67,7 @@ Test templates
]
}
Commit message:
Fuzzy with query: 'foo
Pushed via `mach try fuzzy`

Просмотреть файл

@ -6,13 +6,25 @@ Test preset with no subcommand
$ ./mach try $testargs --save foo -b do -p linux -u mochitests -t none --tag foo
Calculated try selector:
try: -b do -p linux -u mochitests -t none --tag foo
Commit message:
try: -b do -p linux -u mochitests -t none --tag foo
Pushed via `mach try syntax`
preset saved, run with: --preset=foo
$ ./mach try $testargs --preset foo
Calculated try selector:
try: -b do -p linux -u mochitests -t none --tag foo
Commit message:
try: -b do -p linux -u mochitests -t none --tag foo
Pushed via `mach try syntax`
$ ./mach try syntax $testargs --preset foo
Calculated try selector:
try: -b do -p linux -u mochitests -t none --tag foo
Commit message:
try: -b do -p linux -u mochitests -t none --tag foo
Pushed via `mach try syntax`
$ ./mach try $testargs --list-presets
foo: -b do -p linux -u mochitests -t none --tag foo
@ -21,13 +33,25 @@ Test preset with syntax subcommand
$ ./mach try syntax $testargs --save bar -b do -p win32 -u none -t all --tag bar
Calculated try selector:
try: -b do -p win32 -u none -t all --tag bar
Commit message:
try: -b do -p win32 -u none -t all --tag bar
Pushed via `mach try syntax`
preset saved, run with: --preset=bar
$ ./mach try syntax $testargs --preset bar
Calculated try selector:
try: -b do -p win32 -u none -t all --tag bar
Commit message:
try: -b do -p win32 -u none -t all --tag bar
Pushed via `mach try syntax`
$ ./mach try $testargs --preset bar
Calculated try selector:
try: -b do -p win32 -u none -t all --tag bar
Commit message:
try: -b do -p win32 -u none -t all --tag bar
Pushed via `mach try syntax`
$ ./mach try syntax $testargs --list-presets
foo: -b do -p linux -u mochitests -t none --tag foo
bar: -b do -p win32 -u none -t all --tag bar
@ -43,6 +67,10 @@ Test preset with fuzzy subcommand
]
}
Commit message:
Fuzzy with query: 'baz
Pushed via `mach try fuzzy`
$ ./mach try fuzzy $testargs --preset baz
Calculated try selector:
{
@ -51,6 +79,10 @@ Test preset with fuzzy subcommand
]
}
Commit message:
Fuzzy with query: 'baz
Pushed via `mach try fuzzy`
$ ./mach try $testargs --preset baz
Calculated try selector:
{
@ -59,5 +91,9 @@ Test preset with fuzzy subcommand
]
}
Commit message:
Fuzzy with query: 'baz
Pushed via `mach try fuzzy`
$ ./mach try fuzzy $testargs --list-presets
baz: 'baz

Просмотреть файл

@ -97,7 +97,9 @@ class VCSHelper(object):
print(UNCOMMITTED_CHANGES)
sys.exit(1)
def push_to_try(self, msg, labels=None, templates=None, push=True):
def push_to_try(self, method, msg, labels=None, templates=None, push=True):
commit_message = '%s\n\nPushed via `mach try %s`' % (msg, method)
self.check_working_directory(push)
config = None
@ -112,9 +114,12 @@ class VCSHelper(object):
print(fh.read())
else:
print(msg)
print('Commit message:')
print(commit_message)
return
self._push_to_try(msg, config)
self._push_to_try(commit_message, config)
finally:
if config and os.path.isfile(config):
os.remove(config)