Patchwork [2,of,2] bookmarks: adjust exception type so present(bookmark(.)) works as expected

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 25, 2018, 11:56 a.m.
Message ID <593795f469e98d0ced03.1535198167@mimosa>
Download mbox | patch
Permalink /patch/34046/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 25, 2018, 11:56 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1535195967 -32400
#      Sat Aug 25 20:19:27 2018 +0900
# Node ID 593795f469e98d0ced03046c7cff7233341851a4
# Parent  d3e265cb2ff891c7b7a7779399017c69fee0aef7
bookmarks: adjust exception type so present(bookmark(.)) works as expected
Augie Fackler - Aug. 28, 2018, 6:13 p.m.
> On Aug 25, 2018, at 7:56 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1535195967 -32400
> #      Sat Aug 25 20:19:27 2018 +0900
> # Node ID 593795f469e98d0ced03046c7cff7233341851a4
> # Parent  d3e265cb2ff891c7b7a7779399017c69fee0aef7
> bookmarks: adjust exception type so present(bookmark(.)) works as expected

queued, tahnks

Patch

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -240,7 +240,7 @@  class bmstore(object):
             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):
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -345,7 +345,7 @@  demand that one of the bookmarks is acti
   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
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -172,12 +172,9 @@  but "literal:." is not since "." seems n
 
   $ 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 @@  rename bookmark using . with no active b
   $ 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 @@  delete bookmark using . with no active b
   $ 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