[PATCH 5 of 6] obsolete: add an any successors funtion
pierre-yves.david at logilab.fr
pierre-yves.david at logilab.fr
Tue Jul 17 11:49:36 CDT 2012
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1342539089 -7200
# Node ID e684aa58b85911fa1f6f8f0f9571a8b191bf6a3d
# Parent 34404576fe9a255c4329b536572a9d325135e363
obsolete: add an any successors funtion
This function yield every nodes which succeed to a group of nodes.
The first user will be checkheads who need to know if we push successors for
remote extra heads.
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -283,5 +283,19 @@ def precursormarkers(ctx):
def successormarkers(ctx):
"""obsolete marker marking this changeset as a successors"""
for data in ctx._repo.obsstore.successors.get(ctx.node(), ()):
yield marker(ctx._repo, data)
+def anysuccessors(obsstore, node):
+ """Yield every successors of <node>
+
+ This this a linear yield unsuitable to detect splitted changeset."""
+ remaining = set([node])
+ seen = set(remaining)
+ while remaining:
+ current = remaining.pop()
+ yield current
+ for mark in obsstore.precursors.get(current, ()):
+ for suc in mark[1]:
+ if suc not in seen:
+ seen.add(suc)
+ remaining.add(suc)
More information about the Mercurial-devel
mailing list