comparison mercurial/phases.py @ 51422:3cee8706f53b

phases: directly update the phase sets in advanceboundary This is similar to what we do in retractboundary. There is no need to invalidate the cache if we have everything at hand to update it.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 23 Feb 2024 06:37:25 +0100
parents 23950e39281f
children c9ceb4f60256
comparison
equal deleted inserted replaced
51421:23950e39281f 51422:3cee8706f53b
767 767
768 # apply the changes 768 # apply the changes
769 if not dryrun: 769 if not dryrun:
770 for r, p in changed.items(): 770 for r, p in changed.items():
771 _trackphasechange(phasetracking, r, p, targetphase) 771 _trackphasechange(phasetracking, r, p, targetphase)
772 if targetphase > public:
773 self._phasesets[targetphase].update(changed)
772 for phase in affectable_phases: 774 for phase in affectable_phases:
773 roots = self._phaseroots[phase] 775 roots = self._phaseroots[phase]
774 removed = roots & delroots 776 removed = roots & delroots
775 if removed or new_roots[phase]: 777 if removed or new_roots[phase]:
778 self._phasesets[phase].difference_update(changed)
776 # Be careful to preserve shallow-copied values: do not 779 # Be careful to preserve shallow-copied values: do not
777 # update phaseroots values, replace them. 780 # update phaseroots values, replace them.
778 final_roots = roots - delroots | new_roots[phase] 781 final_roots = roots - delroots | new_roots[phase]
779 self._updateroots(repo, phase, final_roots, tr) 782 self._updateroots(
783 repo, phase, final_roots, tr, invalidate=False
784 )
780 if new_target_roots: 785 if new_target_roots:
781 # Thanks for previous filtering, we can't replace existing 786 # Thanks for previous filtering, we can't replace existing
782 # roots 787 # roots
783 new_target_roots |= self._phaseroots[targetphase] 788 new_target_roots |= self._phaseroots[targetphase]
784 self._updateroots(repo, targetphase, new_target_roots, tr) 789 self._updateroots(
790 repo, targetphase, new_target_roots, tr, invalidate=False
791 )
785 repo.invalidatevolatilesets() 792 repo.invalidatevolatilesets()
786 return changed 793 return changed
787 794
788 def retractboundary(self, repo, tr, targetphase, nodes): 795 def retractboundary(self, repo, tr, targetphase, nodes):
789 if tr is None: 796 if tr is None: