branching: merge stable into default
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 25 Mar 2024 16:27:48 +0000
changeset 51538 e4eeb9fedfe3
parent 51537 4a8bb136ee77 (current diff)
parent 51517 4ee50d98d35c (diff)
child 51543 0d83955bc8ac
branching: merge stable into default
--- a/mercurial/phases.py	Thu Mar 07 10:57:16 2024 +0100
+++ b/mercurial/phases.py	Mon Mar 25 16:27:48 2024 +0000
@@ -869,6 +869,8 @@
         start = min(new_revs)
         end = len(cl)
         rev_phases = [None] * (end - start)
+
+        this_phase_set = self._phasesets[targetphase]
         for r in range(start, end):
 
             # gather information about the current_rev
@@ -893,6 +895,7 @@
                     new_roots.add(r)
                 rev_phases[r - start] = targetphase
                 changed_revs[r] = r_phase
+                this_phase_set.add(r)
             elif p_phase is None:
                 rev_phases[r - start] = r_phase
             else:
@@ -903,13 +906,14 @@
                 if p_phase == targetphase:
                     if p_phase > r_phase:
                         changed_revs[r] = r_phase
+                        this_phase_set.add(r)
                     elif r in currentroots:
                         replaced_roots.add(r)
             sets = self._phasesets
-            sets[targetphase].update(changed_revs)
-            for r, old in changed_revs.items():
-                if old > public:
-                    sets[old].discard(r)
+            if targetphase > draft:
+                for r, old in changed_revs.items():
+                    if old > public:
+                        sets[old].discard(r)
 
         if new_roots:
             assert changed_revs