# HG changeset patch # User Pierre-Yves David # Date 2013-12-23 21:36:13 # Node ID cdcbe103b69ab1b27a84b9ddc6ecf5b33ae16ffd # Parent d67a7758da6d21e85da24905bb23d950f256eaef obsolete: add an allprecursors method mirroring allsuccessors one. Detection of bumped changeset should use `allprecursors()` instead or `allsuccessors()` so we need the all precursors function to exists. diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -456,6 +456,28 @@ def allsuccessors(obsstore, nodes, ignor seen.add(suc) remaining.add(suc) +def allprecursors(obsstore, nodes, ignoreflags=0): + """Yield node for every precursors of . + + Some precursors may be unknown locally. + + This is a linear yield unsuited to detecting folded changesets. It includes + initial nodes too.""" + + remaining = set(nodes) + seen = set(remaining) + while remaining: + current = remaining.pop() + yield current + for mark in obsstore.precursors.get(current, ()): + # ignore marker flagged with specified flag + if mark[2] & ignoreflags: + continue + suc = mark[0] + if suc not in seen: + seen.add(suc) + remaining.add(suc) + def foreground(repo, nodes): """return all nodes in the "foreground" of other node