Mercurial > public > mercurial-scm > hg
diff mercurial/discovery.py @ 17011:25f7d40fe735
discovery: convert legacy part of checkheads to revs from nodes
After a recent switch from revlog.reachable to revlog.ancestors,
clean up this old call site, switching it from nodes to revs.
author | Joshua Redstone <joshua.redstone@fb.com> |
---|---|
date | Fri, 08 Jun 2012 14:23:31 -0700 |
parents | 0c18aed2fcca |
children | 6f89c3f0192d |
line wrap: on
line diff
--- a/mercurial/discovery.py Fri Jun 08 14:21:32 2012 -0700 +++ b/mercurial/discovery.py Fri Jun 08 14:23:31 2012 -0700 @@ -207,19 +207,18 @@ # 1-4b. old servers: Check for new topological heads. # Construct {old,new}map with branch = None (topological branch). # (code based on _updatebranchcache) - oldheads = set(h for h in remoteheads if h in cl.nodemap) - newheads = oldheads.union(outgoing.missing) - if len(newheads) > 1: - for latest in reversed(outgoing.missing): - if latest not in newheads: + oldheadrevs = set(cl.rev(h) for h in remoteheads if h in cl.nodemap) + missingrevs = [cl.rev(node) for node in outgoing.missing] + newheadrevs = oldheadrevs.union(missingrevs) + if len(newheadrevs) > 1: + for latest in sorted(missingrevs, reverse=True): + if latest not in newheadrevs: continue - minhrev = min(cl.rev(h) for h in newheads) - reachable = [cl.node(rev) for rev in - cl.ancestors([cl.rev(latest)], minhrev)] - newheads.difference_update(reachable) + reachable = cl.ancestors([latest], min(newheadrevs)) + newheadrevs.difference_update(reachable) branches = set([None]) - newmap = {None: newheads} - oldmap = {None: oldheads} + newmap = {None: [cl.node(rev) for rev in newheadrevs]} + oldmap = {None: [cl.node(rev) for rev in oldheadrevs]} unsynced = inc and branches or set() # 5. Check for new heads.