autoland: don't reference an undefined variable in the error case (
Bug 1294729). r?glob
cmd_output was being referenced in the exception handler, but when
run_hg() would fail it is never assigned. This was causing autoland
to repeatedly loop on a single changeset due to how it would handle
this unexpected exception.
We should no longer get stuck on a single revision when the related
invocation of run_hg() fails.
MozReview-Commit-ID: 5m3aoRMtKA5
--- a/autoland/autoland/transplant.py
+++ b/autoland/autoland/transplant.py
@@ -101,17 +101,17 @@ def _transplant(logger, client, tree, de
json.dump(commit_descriptions, f)
f.flush()
try:
cmd = ['rewritecommitdescriptions',
'--descriptions=%s' % f.name, rev]
cmd_output = run_hg(cmd)
except hglib.error.CommandError as e:
- return False, formulate_hg_error(['hg'] + cmd, cmd_output)
+ return False, formulate_hg_error(['hg'] + cmd, e.out.getvalue())
for line in cmd_output.splitlines():
m = re.search(r'^rev: [0-9a-z]+ -> ([0-9a-z]+)', line)
if m and m.groups():
base_revision = m.groups()[0]
break
if not base_revision: