bookmarks: do not overwrite bookmarks.current if not necessary
If we update to the ref that the bookmarks.current points to, we do
not want to update bookmarks.current
--- a/hgext/bookmarks.py Sat Dec 06 14:03:30 2008 +0200
+++ b/hgext/bookmarks.py Sat Dec 06 19:30:20 2008 +0100
@@ -96,9 +96,15 @@
Set the name of the bookmark that we are on (hg update <bookmark>).
The name is recoreded in .hg/bookmarks.current
'''
- if repo._bookmarkcurrent == mark:
+ if current(repo) == mark:
return
+
refs = parse(repo)
+
+ 'do not update if we do update to an rev equal to the current bookmark'
+ if (mark not in refs and
+ current(repo) and refs[current(repo)] == repo.changectx('.').node()):
+ return
if mark not in refs:
mark = ''
file = repo.opener('bookmarks.current', 'w+')