mercurial/repoview.py
changeset 18272 95ef7a87c053
parent 18250 f54898526aad
child 18273 a2d54f68e13c
--- a/mercurial/repoview.py	Fri Jan 04 03:14:54 2013 +0100
+++ b/mercurial/repoview.py	Fri Jan 04 05:44:01 2013 +0100
@@ -9,6 +9,7 @@
 import copy
 import phases
 import util
+import obsolete, bookmarks, revset
 
 
 def computehidden(repo):
@@ -16,10 +17,19 @@
 
     During most operation hidden should be filtered."""
     assert not repo.changelog.filteredrevs
-    if repo.obsstore:
-        ### hide extinct changeset that are not accessible by any mean
-        hiddenquery = 'extinct() - ::(parents() + bookmark())'
-        return frozenset(repo.revs(hiddenquery))
+    hideable = obsolete.getrevs(repo, 'obsolete')
+    if hideable:
+        cl = repo.changelog
+        firsthideable = min(hideable)
+        revs = cl.revs(start=firsthideable)
+        blockers = [r for r in revset._children(repo, revs, hideable)
+                      if r not in hideable]
+        for par in repo[None].parents():
+            blockers.append(par.rev())
+        for bm in bookmarks.listbookmarks(repo).values():
+            blockers.append(repo[bm].rev())
+        blocked = cl.ancestors(blockers, inclusive=True)
+        return frozenset(r for r in hideable if r not in blocked)
     return frozenset()
 
 def computeunserved(repo):