1. mirror
  2. mercurial-stable


alu  committed cb516e7

bookmarks: fixes bug where a deleted bookmark may still be treated as current when track.current option is set

  • Participants
  • Parent commits f420eaf
  • Branches default

Comments (0)

Files changed (3)

File hgext/bookmarks.py

View file
     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()):
     if mark not in refs:
             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)

File tests/test-bookmarks-current

View file
 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

File tests/test-bookmarks-current.out

View file
 % 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