[PATCH 10 of 11 full-series] obsolete: add an any successors funtion

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jul 17 22:15:57 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1342539089 -7200
# Node ID 65058120b333e7f73f2bf85c1ef938b1b460e383
# Parent  0c90b4f033af368c3abe1bc240d9049588182914
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
@@ -285,3 +285,17 @@
     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