# HG changeset patch # User David Soria Parra # Date 1228588220 -3600 # Node ID 167853c7e54a162917586d3ea3d80b3a2ed5df35 # Parent 187a13bd14c6293c13c9e1207de8ef5bec53b161 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 diff -r 187a13bd14c6 -r 167853c7e54a hgext/bookmarks.py --- 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 ). 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+')