changeset 13620:8ee4b00ddfd8 stable

bookmarks: fix update of the current bookmark during rename We need to get rid of the previous bookmark after changing current bookmark.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 13 Mar 2011 15:42:24 +0100
parents 7359cb753a54
children c0b0b00f0279
files mercurial/commands.py tests/test-bookmarks-current.t
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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