comparison 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
comparison
equal deleted inserted replaced
18103:83cb1a1a705d 18104:a2cebd3e4daa
336 if unsynced: 336 if unsynced:
337 repo.ui.warn(_("note: unsynced remote changes!\n")) 337 repo.ui.warn(_("note: unsynced remote changes!\n"))
338 338
339 def visibleheads(repo): 339 def visibleheads(repo):
340 """return the set of visible head of this repo""" 340 """return the set of visible head of this repo"""
341 # XXX we want a cache on this 341 return repo.filtered('unserved').heads()
342 sroots = repo._phasecache.phaseroots[phases.secret]
343 if sroots or repo.obsstore:
344 # XXX very slow revset. storing heads or secret "boundary"
345 # would help.
346 revset = repo.set('heads(not (%ln:: + extinct()))', sroots)
347
348 vheads = [ctx.node() for ctx in revset]
349 if not vheads:
350 vheads.append(nullid)
351 else:
352 vheads = repo.heads()
353 return vheads
354 342
355 343
356 def visiblebranchmap(repo): 344 def visiblebranchmap(repo):
357 """return a branchmap for the visible set""" 345 """return a branchmap for the visible set"""
358 return repo.filtered('unserved').branchmap() 346 return repo.filtered('unserved').branchmap()