1. Ivan Andrus
  2. hg-prompt


Kevin Bullock  committed 5faf9b0

bookmarks: check if bookmark is actually current

Mercurial doesn't remove the bookmarks.current file when updating away
from a bookmark, and repo._bookmarkcurrent() doesn't check whether the
bookmark read from bookmarks.current is actually current.

This patch prevents hg-prompt from reporting a current bookmark when the
bookmark in bookmarks.current isn't actually the working directory's
first parent. This matches the behavior of the `hg bookmarks` command.

  • Participants
  • Parent commits c4095c3
  • Branches default

Comments (0)

Files changed (1)

File prompt.py

View file
             book = getattr(repo, '_bookmarkcurrent', None)
         except KeyError:
             book = getattr(repo, '_bookmarkcurrent', None)
-        return _with_groups(m.groups(), book) if book else ''
+        if book:
+            cur = repo['.'].node()
+            if repo._bookmarks[book] == cur:
+                return _with_groups(m.groups(), book)
+        else:
+            return ''
     def _branch(m):
         g = m.groups()