changeset 16573:5983de86462c stable 2.2.1

bookmarks: catch the proper exception for missing revisions This fixes a regression from 1.7
author Matt Mackall <mpm@selenic.com>
date Thu, 03 May 2012 16:03:08 -0500
parents 8d44b5a2974f
children b46f21d2edca
files mercurial/bookmarks.py tests/test-bookmarks.t
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Wed May 02 14:37:44 2012 -0700
+++ b/mercurial/bookmarks.py	Thu May 03 16:03:08 2012 -0500
@@ -7,7 +7,7 @@
 
 from mercurial.i18n import _
 from mercurial.node import hex
-from mercurial import encoding, error, util
+from mercurial import encoding, util
 import errno, os
 
 def valid(mark):
@@ -36,7 +36,7 @@
             refspec = encoding.tolocal(refspec)
             try:
                 bookmarks[refspec] = repo.changelog.lookup(sha)
-            except error.RepoLookupError:
+            except LookupError:
                 pass
     except IOError, inst:
         if inst.errno != errno.ENOENT:
--- a/tests/test-bookmarks.t	Wed May 02 14:37:44 2012 -0700
+++ b/tests/test-bookmarks.t	Thu May 03 16:03:08 2012 -0500
@@ -371,3 +371,8 @@
    * Z                         3:125c9a1d6df6
      x  y                      2:db815d6d32e6
 
+test missing revisions
+
+  $ echo "925d80f479bc z" > .hg/bookmarks
+  $ hg book
+  no bookmarks set