# HG changeset patch # User David Soria Parra # Date 2008-12-18 09:51:11 # Node ID fead6cf99a0923e209be154a1e99fb35ff7910a2 # Parent 9b64589b1112cceabda67722eef23d69b9770ec2 bookmarks: set the current bookmark to the new name if we rename the current bookmark If we rename the current bookmark, we have to set the current bookmark to the new name. diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py --- a/hgext/bookmarks.py +++ b/hgext/bookmarks.py @@ -64,9 +64,9 @@ def write(repo, refs): ''' if os.path.exists(repo.join('bookmarks')): util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks')) - file = repo.opener('bookmarks', 'w+') if current(repo) not in refs: setcurrent(repo, None) + file = repo.opener('bookmarks', 'w+') for refspec, node in refs.items(): file.write("%s %s\n" % (hex(node), refspec)) file.close() @@ -138,6 +138,8 @@ def bookmark(ui, repo, mark=None, rev=No raise util.Abort(_("new bookmark name required")) marks[mark] = marks[rename] del marks[rename] + if current(repo) == rename: + setcurrent(repo, mark) write(repo, marks) return