mercurial/discovery.py
changeset 18103 83cb1a1a705d
parent 17827 612db9d7e76a
child 18104 a2cebd3e4daa
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