mercurial/discovery.py
changeset 17205 97eff00046de
parent 17204 4feb55e6931f
child 17206 70ebb4bd8083
equal deleted inserted replaced
17204:4feb55e6931f 17205:97eff00046de
   111     # compute outgoing
   111     # compute outgoing
   112     if not repo._phasecache.phaseroots[phases.secret]:
   112     if not repo._phasecache.phaseroots[phases.secret]:
   113         og.missingheads = onlyheads or repo.heads()
   113         og.missingheads = onlyheads or repo.heads()
   114     elif onlyheads is None:
   114     elif onlyheads is None:
   115         # use visible heads as it should be cached
   115         # use visible heads as it should be cached
   116         og.missingheads = phases.visibleheads(repo)
   116         og.missingheads = visibleheads(repo)
   117         og.excluded = [ctx.node() for ctx in repo.set('secret()')]
   117         og.excluded = [ctx.node() for ctx in repo.set('secret()')]
   118     else:
   118     else:
   119         # compute common, missing and exclude secret stuff
   119         # compute common, missing and exclude secret stuff
   120         sets = repo.changelog.findcommonmissing(og.commonheads, onlyheads)
   120         sets = repo.changelog.findcommonmissing(og.commonheads, onlyheads)
   121         og._common, allmissing = sets
   121         og._common, allmissing = sets
   259         raise util.Abort(error, hint=hint)
   259         raise util.Abort(error, hint=hint)
   260 
   260 
   261     # 6. Check for unsynced changes on involved branches.
   261     # 6. Check for unsynced changes on involved branches.
   262     if unsynced:
   262     if unsynced:
   263         repo.ui.warn(_("note: unsynced remote changes!\n"))
   263         repo.ui.warn(_("note: unsynced remote changes!\n"))
       
   264 
       
   265 def visibleheads(repo):
       
   266     """return the set of visible head of this repo"""
       
   267     # XXX we want a cache on this
       
   268     sroots = repo._phasecache.phaseroots[phases.secret]
       
   269     if sroots:
       
   270         # XXX very slow revset. storing heads or secret "boundary" would help.
       
   271         revset = repo.set('heads(not (%ln::))', sroots)
       
   272 
       
   273         vheads = [ctx.node() for ctx in revset]
       
   274         if not vheads:
       
   275             vheads.append(nullid)
       
   276     else:
       
   277         vheads = repo.heads()
       
   278     return vheads
       
   279 
       
   280 def visiblebranchmap(repo):
       
   281     """return a branchmap for the visible set"""
       
   282     # XXX Recomputing this data on the fly is very slow.  We should build a
       
   283     # XXX cached version while computin the standard branchmap version.
       
   284     sroots = repo._phasecache.phaseroots[phases.secret]
       
   285     if sroots:
       
   286         vbranchmap = {}
       
   287         for branch, nodes in  repo.branchmap().iteritems():
       
   288             # search for secret heads.
       
   289             for n in nodes:
       
   290                 if repo[n].phase() >= phases.secret:
       
   291                     nodes = None
       
   292                     break
       
   293             # if secreat heads where found we must compute them again
       
   294             if nodes is None:
       
   295                 s = repo.set('heads(branch(%s) - secret())', branch)
       
   296                 nodes = [c.node() for c in s]
       
   297             vbranchmap[branch] = nodes
       
   298     else:
       
   299         vbranchmap = repo.branchmap()
       
   300     return vbranchmap
       
   301