[PATCH stable] bookmarks: ensure current bookmark is updated when specified with -r

Brodie Rao brodie at bitheap.org
Wed Jul 14 10:02:22 CDT 2010


# HG changeset patch
# User Brodie Rao <brodie at bitheap.org>
# Date 1279119740 14400
# Branch stable
# Node ID 6eb4f133ffb877974dc42870e014c9b91fcd6187
# Parent  6f44bd4cc4f2277fcdc0a5d3e7f58c26234a70cf
bookmarks: ensure current bookmark is updated when specified with -r .

"hg bookmark -r . foo" should be equivalent to "hg bookmark foo".

diff -r 6f44bd4cc4f2 -r 6eb4f133ffb8 hgext/bookmarks.py
--- a/hgext/bookmarks.py	Sat Jul 10 14:28:38 2010 -0300
+++ b/hgext/bookmarks.py	Wed Jul 14 11:02:20 2010 -0400
@@ -146,7 +146,7 @@ def bookmark(ui, repo, mark=None, rev=No
             marks[mark] = repo.lookup(rev)
         else:
             marks[mark] = repo.changectx('.').node()
-            setcurrent(repo, mark)
+        setcurrent(repo, mark)
         write(repo)
         return
 
diff -r 6f44bd4cc4f2 -r 6eb4f133ffb8 tests/test-bookmarks-current
--- a/tests/test-bookmarks-current	Sat Jul 10 14:28:38 2010 -0300
+++ b/tests/test-bookmarks-current	Wed Jul 14 11:02:20 2010 -0400
@@ -57,3 +57,8 @@ hg bookmark
 echo % update to tip
 hg update tip
 
+echo % set bookmark Y using -r .
+hg bookmark -r . Y
+
+echo % list bookmarks
+hg bookmark
diff -r 6f44bd4cc4f2 -r 6eb4f133ffb8 tests/test-bookmarks-current.out
--- a/tests/test-bookmarks-current.out	Sat Jul 10 14:28:38 2010 -0300
+++ b/tests/test-bookmarks-current.out	Wed Jul 14 11:02:20 2010 -0400
@@ -25,3 +25,6 @@ 0 files updated, 0 files merged, 0 files
 no bookmarks set
 % update to tip
 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+% set bookmark Y using -r .
+% list bookmarks
+ * Y                         0:719295282060


More information about the Mercurial-devel mailing list