bookmarks: adjust exception type so present(bookmark(.)) works as expected
authorYuya Nishihara <yuya@tcha.org>
Sat, 25 Aug 2018 20:19:27 +0900
changeset 39304 fc54a290b4b0
parent 39303 1eb370761fa0
child 39305 200ad3e85a97
bookmarks: adjust exception type so present(bookmark(.)) works as expected
mercurial/bookmarks.py
tests/test-bookmarks-pushpull.t
tests/test-bookmarks.t
--- a/mercurial/bookmarks.py	Sat Aug 25 20:16:28 2018 +0900
+++ b/mercurial/bookmarks.py	Sat Aug 25 20:19:27 2018 +0900
@@ -240,7 +240,7 @@
             if self.active:
                 return self.active
             else:
-                raise error.Abort(_("no active bookmark"))
+                raise error.RepoLookupError(_("no active bookmark"))
         return bname
 
     def checkconflict(self, mark, force=False, target=None):
--- a/tests/test-bookmarks-pushpull.t	Sat Aug 25 20:16:28 2018 +0900
+++ b/tests/test-bookmarks-pushpull.t	Sat Aug 25 20:19:27 2018 +0900
@@ -345,7 +345,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (leaving bookmark V)
   $ hg push -B . ../a
-  abort: no active bookmark
+  abort: no active bookmark!
   [255]
   $ hg update -r V
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
--- a/tests/test-bookmarks.t	Sat Aug 25 20:16:28 2018 +0900
+++ b/tests/test-bookmarks.t	Sat Aug 25 20:19:27 2018 +0900
@@ -172,12 +172,9 @@
 
   $ hg bookmark --inactive
   $ hg log -r 'bookmark(.)'
-  abort: no active bookmark
+  abort: no active bookmark!
   [255]
-BUG: this should be resolved to an empty set:
   $ hg log -r 'present(bookmark(.))'
-  abort: no active bookmark
-  [255]
 
   $ hg log -r 'bookmark(unknown)'
   abort: bookmark 'unknown' does not exist!
@@ -263,7 +260,7 @@
   $ hg book rename-me
   $ hg book -i rename-me
   $ hg book -m . renamed
-  abort: no active bookmark
+  abort: no active bookmark!
   [255]
   $ hg up -q Y
   $ hg book -d rename-me
@@ -283,7 +280,7 @@
   $ hg book delete-me
   $ hg book -i delete-me
   $ hg book -d .
-  abort: no active bookmark
+  abort: no active bookmark!
   [255]
   $ hg up -q Y
   $ hg book -d delete-me