# HG changeset patch # User Alex Unden # Date 1235728905 28800 # Node ID cb516e788238f1ae1ced4fdfd91fd8b8cdb68b2a # Parent f420eafe59cdd14aa882d725eeb99f119bf37388 bookmarks: fixes bug where a deleted bookmark may still be treated as current when track.current option is set diff -r f420eafe59cd -r cb516e788238 hgext/bookmarks.py --- 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 diff -r f420eafe59cd -r cb516e788238 tests/test-bookmarks-current --- 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 + diff -r f420eafe59cd -r cb516e788238 tests/test-bookmarks-current.out --- 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