comparison mercurial/discovery.py @ 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 612db9d7e76a
children a2cebd3e4daa
comparison
equal deleted inserted replaced
18102:3c7b67b76190 18103:83cb1a1a705d
353 return vheads 353 return vheads
354 354
355 355
356 def visiblebranchmap(repo): 356 def visiblebranchmap(repo):
357 """return a branchmap for the visible set""" 357 """return a branchmap for the visible set"""
358 # XXX Recomputing this data on the fly is very slow. We should build a 358 return repo.filtered('unserved').branchmap()
359 # XXX cached version while computing the standard branchmap version.
360 sroots = repo._phasecache.phaseroots[phases.secret]
361 if sroots or repo.obsstore:
362 vbranchmap = {}
363 for branch, nodes in repo.branchmap().iteritems():
364 # search for secret heads.
365 for n in nodes:
366 if repo[n].phase() >= phases.secret:
367 nodes = None
368 break
369 # if secret heads were found we must compute them again
370 if nodes is None:
371 s = repo.set('heads(branch(%s) - secret() - extinct())',
372 branch)
373 nodes = [c.node() for c in s]
374 vbranchmap[branch] = nodes
375 else:
376 vbranchmap = repo.branchmap()
377 return vbranchmap