[PATCH 1 of 4] checkheads: pass "ispushed" function to the obsmarkers logic

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Jun 10 01:32:18 UTC 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1496672267 -3600
#      Mon Jun 05 15:17:47 2017 +0100
# Node ID a3ee0f19258d0c7565cfb436112e74740dab1d80
# Parent  326c0e2c1a1d59e07f4c9d86f81e4419c3d779d8
# EXP-Topic skipctx
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r a3ee0f19258d
checkheads: pass "ispushed" function to the obsmarkers logic

We are about to make "allfuturecommon" a set of revs instead of a set of nodes.
The function updated in this patch do not needs to know about these details so
we just pass it a 'ispushed(node)' function. This will simplify the next
changeset.

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -443,8 +443,8 @@ def _postprocessobsolete(pushop, futurec
     public = phases.public
     getphase = unfi._phasecache.phase
     ispublic = (lambda r: getphase(unfi, r) == public)
-    hasoutmarker = functools.partial(pushingmarkerfor, unfi.obsstore,
-                                     futurecommon)
+    ispushed = (lambda n: n in futurecommon)
+    hasoutmarker = functools.partial(pushingmarkerfor, unfi.obsstore, ispushed)
     successorsmarkers = unfi.obsstore.successors
     newhs = set() # final set of new heads
     discarded = set() # new head of fully replaced branch
@@ -496,7 +496,7 @@ def _postprocessobsolete(pushop, futurec
     newhs |= unknownheads
     return newhs, discarded
 
-def pushingmarkerfor(obsstore, pushset, node):
+def pushingmarkerfor(obsstore, ispushed, node):
     """true if some markers are to be pushed for node
 
     We cannot just look in to the pushed obsmarkers from the pushop because
@@ -512,7 +512,7 @@ def pushingmarkerfor(obsstore, pushset, 
     seen = set(stack)
     while stack:
         current = stack.pop()
-        if current in pushset:
+        if ispushed(current):
             return True
         markers = successorsmarkers.get(current, ())
         # markers fields = ('prec', 'succs', 'flag', 'meta', 'date', 'parents')


More information about the Mercurial-devel mailing list