# HG changeset patch # User Pierre-Yves David # Date 2017-06-05 12:37:04 # Node ID 1cb14923dee9bdf8bfb81254efdbedbe63c2f61a # Parent d4b5468719da6b847fec3a9ace9744d12403e2de checkheads: use "revnum" in the "allfuturecommon" set The obsolete post-processing needs to know the extend of the pushed set. The way it is implemented is... suboptimal. It build a full set of all nodes in the pushset and it does so using changectx. We have much better API for this now. The simplest is to use the existing lazy ancestors computation. That logic uses revnum and not node (for good reason) so we start with updating the post-processing code to handle a "allfuturecommon" set containing revision numbers. diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -250,8 +250,9 @@ def _headssummary(pushop): if repo.obsstore: allmissing = set(outgoing.missing) cctx = repo.set('%ld', outgoing.common) - allfuturecommon = set(c.node() for c in cctx) - allfuturecommon.update(allmissing) + allfuturecommon = set(c.rev() for c in cctx) + torev = repo.changelog.rev + allfuturecommon.update(torev(m) for m in allmissing) for branch, heads in sorted(headssum.iteritems()): remoteheads, newheads, unsyncedheads, placeholder = heads result = _postprocessobsolete(pushop, allfuturecommon, newheads) @@ -443,7 +444,7 @@ def _postprocessobsolete(pushop, futurec public = phases.public getphase = unfi._phasecache.phase ispublic = (lambda r: getphase(unfi, r) == public) - ispushed = (lambda n: n in futurecommon) + ispushed = (lambda n: torev(n) in futurecommon) hasoutmarker = functools.partial(pushingmarkerfor, unfi.obsstore, ispushed) successorsmarkers = unfi.obsstore.successors newhs = set() # final set of new heads @@ -469,7 +470,7 @@ def _postprocessobsolete(pushop, futurec while localcandidate: nh = localcandidate.pop() # run this check early to skip the evaluation of the whole branch - if (nh in futurecommon or ispublic(torev(nh))): + if (torev(nh) in futurecommon or ispublic(torev(nh))): newhs.add(nh) continue @@ -484,7 +485,7 @@ def _postprocessobsolete(pushop, futurec # * any part of it is considered part of the result by previous logic, # * if we have no markers to push to obsolete it. if (any(ispublic(r) for r in branchrevs) - or any(n in futurecommon for n in branchnodes) + or any(torev(n) in futurecommon for n in branchnodes) or any(not hasoutmarker(n) for n in branchnodes)): newhs.add(nh) else: