Patchwork [2,of,2] revset: strip off "literal:" prefix from bookmark not found error

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 8, 2015, 3:39 p.m.
Message ID <89b4acf69d7619220dda.1444318752@mimosa>
Download mbox | patch
Permalink /patch/10877/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 8, 2015, 3:39 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1444226671 -32400
#      Wed Oct 07 23:04:31 2015 +0900
# Node ID 89b4acf69d7619220dda12fc8a9482587746310d
# Parent  972718693a474e8cba92c1f36cbd52f969d99242
revset: strip off "literal:" prefix from bookmark not found error

This is what branch() and tag() do.
Augie Fackler - Oct. 8, 2015, 5:53 p.m.
On Fri, Oct 09, 2015 at 12:39:12AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1444226671 -32400
> #      Wed Oct 07 23:04:31 2015 +0900
> # Node ID 89b4acf69d7619220dda12fc8a9482587746310d
> # Parent  972718693a474e8cba92c1f36cbd52f969d99242
> revset: strip off "literal:" prefix from bookmark not found error

queued, thanks

>
> This is what branch() and tag() do.
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -696,7 +696,7 @@ def bookmark(repo, subset, x):
>              bmrev = repo._bookmarks.get(pattern, None)
>              if not bmrev:
>                  raise error.RepoLookupError(_("bookmark '%s' does not exist")
> -                                            % bm)
> +                                            % pattern)
>              bms.add(repo[bmrev].rev())
>          else:
>              matchrevs = set()
> diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
> --- a/tests/test-bookmarks.t
> +++ b/tests/test-bookmarks.t
> @@ -135,6 +135,9 @@ bookmarks revset
>    $ hg log -r 'bookmark(unknown)'
>    abort: bookmark 'unknown' does not exist!
>    [255]
> +  $ hg log -r 'bookmark("literal:unknown")'
> +  abort: bookmark 'unknown' does not exist!
> +  [255]
>    $ hg log -r 'bookmark("re:unknown")'
>    abort: no bookmarks exist that match 'unknown'!
>    [255]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -696,7 +696,7 @@  def bookmark(repo, subset, x):
             bmrev = repo._bookmarks.get(pattern, None)
             if not bmrev:
                 raise error.RepoLookupError(_("bookmark '%s' does not exist")
-                                            % bm)
+                                            % pattern)
             bms.add(repo[bmrev].rev())
         else:
             matchrevs = set()
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -135,6 +135,9 @@  bookmarks revset
   $ hg log -r 'bookmark(unknown)'
   abort: bookmark 'unknown' does not exist!
   [255]
+  $ hg log -r 'bookmark("literal:unknown")'
+  abort: bookmark 'unknown' does not exist!
+  [255]
   $ hg log -r 'bookmark("re:unknown")'
   abort: no bookmarks exist that match 'unknown'!
   [255]