changeset 17686:6e4b962600a3

bookmarks: teach the -r option to use revsets
author David Soria Parra <dsp@php.net>
date Mon, 01 Oct 2012 03:19:23 +0200
parents 8fcef9614150
children aa0647830fd9
files mercurial/commands.py tests/test-bookmarks.t
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Sep 29 13:41:02 2012 +0200
+++ b/mercurial/commands.py	Mon Oct 01 03:19:23 2012 +0200
@@ -833,7 +833,7 @@
             raise util.Abort(
                 _("a bookmark cannot have the name of an existing branch"))
         if rev:
-            marks[mark] = repo.lookup(rev)
+            marks[mark] = scmutil.revsingle(repo, rev).node()
         else:
             marks[mark] = cur
         if not inactive and cur == marks[mark]:
--- a/tests/test-bookmarks.t	Sat Sep 29 13:41:02 2012 +0200
+++ b/tests/test-bookmarks.t	Mon Oct 01 03:19:23 2012 +0200
@@ -154,6 +154,19 @@
    * Y                         2:db815d6d32e6
      Z                         0:f7b1eb17ad24
 
+bookmarks from a revset
+  $ hg bookmark -r '.^1' REVSET
+  $ hg bookmark -r ':tip' TIP
+  $ hg bookmarks
+     REVSET                    0:f7b1eb17ad24
+   * TIP                       2:db815d6d32e6
+     X2                        1:925d80f479bb
+     Y                         2:db815d6d32e6
+     Z                         0:f7b1eb17ad24
+
+  $ hg bookmark -d REVSET
+  $ hg bookmark -d TIP
+
 rename without new name
 
   $ hg bookmark -m Y