changeset 17213:7eb5aa1f83fd

obsolete: add an any successors function 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.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 17 Jul 2012 17:31:29 +0200
parents 246131d670c2
children 738ad56dd8a6
files mercurial/obsolete.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Tue Jul 17 18:14:16 2012 +0200
+++ b/mercurial/obsolete.py	Tue Jul 17 17:31:29 2012 +0200
@@ -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 successor 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)