bookmarks: fix update of the current bookmark during rename stable
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 13 Mar 2011 15:42:24 +0100
branchstable
changeset 13620 8ee4b00ddfd8
parent 13610 7359cb753a54
child 13621 c0b0b00f0279
bookmarks: fix update of the current bookmark during rename We need to get rid of the previous bookmark after changing current bookmark.
mercurial/commands.py
tests/test-bookmarks-current.t
--- a/mercurial/commands.py	Sun Mar 13 14:26:32 2011 +0100
+++ b/mercurial/commands.py	Sun Mar 13 15:42:24 2011 +0100
@@ -487,9 +487,9 @@
         if mark is None:
             raise util.Abort(_("new bookmark name required"))
         marks[mark] = marks[rename]
-        del marks[rename]
         if repo._bookmarkcurrent == rename:
             bookmarks.setcurrent(repo, mark)
+        del marks[rename]
         bookmarks.write(repo)
         return
 
--- a/tests/test-bookmarks-current.t	Sun Mar 13 14:26:32 2011 +0100
+++ b/tests/test-bookmarks-current.t	Sun Mar 13 15:42:24 2011 +0100
@@ -36,6 +36,10 @@
 
 list bookmarks
 
+  $ cat .hg/bookmarks.current
+  Z (no-eol)
+  $ cat .hg/bookmarks
+  0000000000000000000000000000000000000000 Z
   $ hg bookmarks
    * Z                         -1:000000000000