changeset 32811:1cb14923dee9

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Jun 2017 13:37:04 +0100
parents d4b5468719da
children 4374e88e808c
files mercurial/discovery.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/discovery.py	Mon Jun 05 15:20:20 2017 +0100
+++ b/mercurial/discovery.py	Mon Jun 05 13:37:04 2017 +0100
@@ -250,8 +250,9 @@
     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 @@
     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 @@
     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 @@
         # * 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: