# HG changeset patch # User Pierre-Yves David # Date 2015-03-19 20:00:44 # Node ID 77eace2a63cbb1f422c0ae8cd902b397d790a184 # Parent dc7588ce06b30a6ef347f7554e9646ac00e4456a obsolete: avoid infinite loop from obs-cycle in divergence (issue4126) As for other currently in place cycle detection, arbitrarily cut the first obsolescence link that create a cycle avoiding the infinite loop. This will have to be made more deterministic in the future but we do not really care right now. diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -1164,8 +1164,12 @@ def _computedivergentset(repo): for ctx in repo.set('(not public()) - obsolete()'): mark = obsstore.precursors.get(ctx.node(), ()) toprocess = set(mark) + seen = set() while toprocess: prec = toprocess.pop()[0] + if prec in seen: + continue # emergency cycle hanging prevention + seen.add(prec) if prec not in newermap: successorssets(repo, prec, newermap) newer = [n for n in newermap[prec] if n]