[PATCH 1 of 2 RFCv2] repoview: hide bookmarks that are prefixed with '.hg/'

Idan Kamara idankk86 at gmail.com
Thu Feb 14 18:15:22 CST 2013

# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1360886120 -7200
# Node ID d4c029076cf2213ad680a53dfd32b0886b2b7be0
# Parent  af4387d8d1c79ed597bdba7e8e41433efd5255ed
repoview: hide bookmarks that are prefixed with '.hg/'

These bookmarks are used internally by things like stashed commits
and should be hidden.

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -16,7 +16,11 @@
     """Revisions candidates to be hidden
     This is a standalone function to help extensions to wrap it."""
-    return obsolete.getrevs(repo, 'obsolete')
+    revs = list(obsolete.getrevs(repo, 'obsolete'))
+    for name, node in repo._bookmarks.items():
+        if name.startswith('.hg/'):
+            revs.append(repo[node].rev())
+    return revs
 def computehidden(repo):
     """compute the set of hidden revision to filter
@@ -32,7 +36,10 @@
                       if r not in hideable]
         for par in repo[None].parents():
-        for bm in repo._bookmarks.values():
+        for name, bm in repo._bookmarks.items():
+            # internal bookmarks should remain hidden
+            if name.startswith('.hg/'):
+                continue
         blocked = cl.ancestors(blockers, inclusive=True)
         return frozenset(r for r in hideable if r not in blocked)

More information about the Mercurial-devel mailing list