Mercurial > hg-stable
changeset 7817:cb516e788238
bookmarks: fixes bug where a deleted bookmark may still be treated as current when track.current option is set
author | Alex Unden <alu@zpuppet.org> |
---|---|
date | Fri, 27 Feb 2009 02:01:45 -0800 |
parents | f420eafe59cd |
children | b6b9065c20b3 |
files | hgext/bookmarks.py tests/test-bookmarks-current tests/test-bookmarks-current.out |
diffstat | 3 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/bookmarks.py Sun Mar 01 00:30:01 2009 +0100 +++ b/hgext/bookmarks.py Fri Feb 27 02:01:45 2009 -0800 @@ -100,7 +100,7 @@ refs = parse(repo) # do not update if we do update to a rev equal to the current bookmark - if (mark not in refs and + if (mark and mark not in refs and current(repo) and refs[current(repo)] == repo.changectx('.').node()): return if mark not in refs: @@ -146,6 +146,8 @@ raise util.Abort(_("bookmark name required")) if mark not in marks: raise util.Abort(_("a bookmark of this name does not exist")) + if mark == current(repo): + setcurrent(repo, None) del marks[mark] write(repo, marks) return
--- a/tests/test-bookmarks-current Sun Mar 01 00:30:01 2009 +0100 +++ b/tests/test-bookmarks-current Fri Feb 27 02:01:45 2009 -0800 @@ -42,3 +42,14 @@ echo % list bookmarks hg bookmark + +echo % delete bookmarks +hg bookmark -d Y +hg bookmark -d Z + +echo % list bookmarks +hg bookmark + +echo % update to tip +hg update tip +
--- a/tests/test-bookmarks-current.out Sun Mar 01 00:30:01 2009 +0100 +++ b/tests/test-bookmarks-current.out Fri Feb 27 02:01:45 2009 -0800 @@ -18,3 +18,8 @@ % list bookmarks * Y 0:719295282060 Z -1:000000000000 +% delete bookmarks +% list bookmarks +no bookmarks set +% update to tip +0 files updated, 0 files merged, 0 files removed, 0 files unresolved