# HG changeset patch # User Pierre-Yves David # Date 2012-07-17 15:31:29 # Node ID 7eb5aa1f83fd175dcb8e23de46547ce545b3e20f # Parent 246131d670c263d8006371b71dc56841ea7f3551 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. diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -285,3 +285,17 @@ def successormarkers(ctx): for data in ctx._repo.obsstore.successors.get(ctx.node(), ()): yield marker(ctx._repo, data) +def anysuccessors(obsstore, node): + """Yield every successor of + + 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)