hgmo: catch proper exception when looking up changeset (
bug 1257152); r?dminor
LookupError is raised by revlogs. RepoLookupError is raised when looking
up changesets. Derp.
MozReview-Commit-ID: LH7J1hvuK18
--- a/hgext/hgmo/__init__.py
+++ b/hgext/hgmo/__init__.py
@@ -128,17 +128,17 @@ def addmetadata(repo, ctx, d, onlycheap=
d['backsoutnodes'] = []
backouts = commitparser.parse_backouts(ctx.description())
if backouts:
for node in backouts[0]:
try:
bctx = repo[node]
d['backsoutnodes'].append({'node': bctx.hex()})
- except error.LookupError:
+ except error.RepoLookupError:
pass
# Repositories can define which TreeHerder repository they are associated
# with.
treeherder = repo.ui.config('mozilla', 'treeherder_repo')
if treeherder:
d['treeherderrepourl'] = 'https://treeherder.mozilla.org/#/jobs?repo=%s' % treeherder
--- a/hgext/hgmo/tests/test-backouts.t
+++ b/hgext/hgmo/tests/test-backouts.t
@@ -32,19 +32,22 @@ Backed out commits should show warnings
<tr><td colspan="2"><strong>💩💩 backed out by <a style="font-family: monospace" href="/rev/f8c8d5d22c7d">f8c8d5d22c7d</a> 💩 💩</strong></td></tr>
Backout commit links to backed out commit
$ http http://localhost:$HGPORT/rev/f8c8d5d22c7d --body-file body > /dev/null
$ grep '<td>backs out' body
<tr><td>backs out</td><td><a style="font-family: monospace" href="/rev/6c9721b3b4df">6c9721b3b4df</a></td></tr>
-Reference a backed out node that doesn't exist
+Reference a backed out node that doesn't exist (bug 1257152)
$ hg -q up -r 0
$ echo badnode > foo
$ hg commit -m 'Backed out changeset deadbeefbead (bug 123)'
created new head
$ hg -q push -f
$ http http://localhost:$HGPORT/rev/bdfc7e1edbe7 --body-file body > /dev/null
$ grep 'unknown revision' body
- unknown revision 'deadbeefbead'
+ [1]
+
+ $ grep 'backs out' body
+ [1]