Mercurial > hg
changeset 7484:167853c7e54a
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
author | David Soria Parra <dsp@php.net> |
---|---|
date | Sat, 06 Dec 2008 19:30:20 +0100 |
parents | 187a13bd14c6 |
children | ecfb683675ed 63446383dfb7 |
files | hgext/bookmarks.py |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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+')