changeset 18103:83cb1a1a705d

clfilter: use filtering in `visiblebranchmap` Here is the first 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 branchmap 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@logilab.fr>
date Mon, 17 Dec 2012 17:42:34 +0100
parents 3c7b67b76190
children a2cebd3e4daa
files mercurial/discovery.py
diffstat 1 files changed, 1 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/discovery.py	Mon Dec 17 17:12:02 2012 +0100
+++ b/mercurial/discovery.py	Mon Dec 17 17:42:34 2012 +0100
@@ -355,23 +355,4 @@
 
 def visiblebranchmap(repo):
     """return a branchmap for the visible set"""
-    # XXX Recomputing this data on the fly is very slow.  We should build a
-    # XXX cached version while computing the standard branchmap version.
-    sroots = repo._phasecache.phaseroots[phases.secret]
-    if sroots or repo.obsstore:
-        vbranchmap = {}
-        for branch, nodes in  repo.branchmap().iteritems():
-            # search for secret heads.
-            for n in nodes:
-                if repo[n].phase() >= phases.secret:
-                    nodes = None
-                    break
-            # if secret heads were found we must compute them again
-            if nodes is None:
-                s = repo.set('heads(branch(%s) - secret() - extinct())',
-                             branch)
-                nodes = [c.node() for c in s]
-            vbranchmap[branch] = nodes
-    else:
-        vbranchmap = repo.branchmap()
-    return vbranchmap
+    return repo.filtered('unserved').branchmap()