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.
--- 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]