diff mercurial/discovery.py @ 18104:a2cebd3e4daa

clfilter: use filtering in `visibleheads` This is the second real use of changelog filtering. The change is very small to allow testing the new filter with a setup close to the original one. We replace custom post processing on `heads`function by call to the standard code pass on a filtering repo. In later coming will have wider usage of filtering that will make the dedicated function useless.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 17 Dec 2012 17:27:12 +0100
parents 83cb1a1a705d
children 88990d3e3d75
line wrap: on
line diff
--- a/mercurial/discovery.py	Mon Dec 17 17:42:34 2012 +0100
+++ b/mercurial/discovery.py	Mon Dec 17 17:27:12 2012 +0100
@@ -338,19 +338,7 @@
 
 def visibleheads(repo):
     """return the set of visible head of this repo"""
-    # XXX we want a cache on this
-    sroots = repo._phasecache.phaseroots[phases.secret]
-    if sroots or repo.obsstore:
-        # XXX very slow revset. storing heads or secret "boundary"
-        # would help.
-        revset = repo.set('heads(not (%ln:: + extinct()))', sroots)
-
-        vheads = [ctx.node() for ctx in revset]
-        if not vheads:
-            vheads.append(nullid)
-    else:
-        vheads = repo.heads()
-    return vheads
+    return repo.filtered('unserved').heads()
 
 
 def visiblebranchmap(repo):