hgmo: catch proper exception when looking up changeset (bug 1257152); r?dminor draft
authorGregory Szorc <gps@mozilla.com>
Wed, 16 Mar 2016 12:46:52 -0700
changeset 7500 f978bc9ab883fbbc72ee656e98570b515e7be345
parent 7499 daa65047d9af09ffe9846b20b9e7760a43d866d7
push id696
push usergszorc@mozilla.com
push dateWed, 16 Mar 2016 19:47:39 +0000
reviewersdminor
bugs1257152
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
hgext/hgmo/__init__.py
hgext/hgmo/tests/test-backouts.t
--- 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>&#x1f4a9;&#x1f4a9; backed out by <a style="font-family: monospace" href="/rev/f8c8d5d22c7d">f8c8d5d22c7d</a> &#x1f4a9; &#x1f4a9;</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]