# HG changeset patch # User Pierre-Yves David # Date 1426795244 25200 # 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 -r dc7588ce06b3 -r 77eace2a63cb mercurial/obsolete.py --- a/mercurial/obsolete.py Thu Mar 19 15:21:08 2015 -0500 +++ b/mercurial/obsolete.py Thu Mar 19 13:00:44 2015 -0700 @@ -1164,8 +1164,12 @@ 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]