diff -r 6b2aeeec3ed0 -r c9ceb4f60256 mercurial/phases.py --- a/mercurial/phases.py Thu Mar 14 16:25:46 2024 +0100 +++ b/mercurial/phases.py Fri Mar 15 01:31:57 2024 +0100 @@ -703,6 +703,7 @@ return set() # search for affected high phase changesets and roots + seen = set(new_revs) push = heapq.heappush pop = heapq.heappop parents = cl.parentrevs @@ -735,9 +736,11 @@ # higher phases delroots.add(current) # schedule a walk down if needed - if p1_phase > targetphase: + if p1_phase > targetphase and p1 not in seen: + seen.add(p1) push(revs, -p1) - if p2_phase > targetphase: + if p2_phase > targetphase and p2 not in seen: + seen.add(p2) push(revs, -p2) if p1_phase < targetphase and p2_phase < targetphase: new_target_roots.add(current)