663 |
663 |
664 Returns a set of revs whose phase is changed or should be changed |
664 Returns a set of revs whose phase is changed or should be changed |
665 """ |
665 """ |
666 if targetphase == public and not self.hasnonpublicphases(repo): |
666 if targetphase == public and not self.hasnonpublicphases(repo): |
667 return set() |
667 return set() |
|
668 repo = repo.unfiltered() |
|
669 cl = repo.changelog |
|
670 torev = cl.index.rev |
668 # Be careful to preserve shallow-copied values: do not update |
671 # Be careful to preserve shallow-copied values: do not update |
669 # phaseroots values, replace them. |
672 # phaseroots values, replace them. |
670 if revs is None: |
673 new_revs = set() |
671 revs = [] |
674 if revs is not None: |
672 if not revs and not nodes: |
675 new_revs.update(revs) |
673 return set() |
676 if nodes is not None: |
|
677 new_revs.update(torev(node) for node in nodes) |
|
678 if not new_revs: # bail out early to avoid the loadphaserevs call |
|
679 return ( |
|
680 set() |
|
681 ) # note: why do people call advanceboundary with nothing? |
|
682 |
674 if tr is None: |
683 if tr is None: |
675 phasetracking = None |
684 phasetracking = None |
676 else: |
685 else: |
677 phasetracking = tr.changes.get(b'phases') |
686 phasetracking = tr.changes.get(b'phases') |
678 |
687 |
679 repo = repo.unfiltered() |
688 # filter revision already in the right phase |
680 revs = [repo[n].rev() for n in nodes] + [r for r in revs] |
689 self._ensure_phase_sets(repo) |
681 |
690 for phase, revs in self._phasesets.items(): |
|
691 if phase <= targetphase: |
|
692 new_revs -= revs |
|
693 if not new_revs: |
|
694 return set() |
|
695 |
|
696 # search for affected high phase changesets and roots |
|
697 revs = new_revs |
682 changes = set() # set of revisions to be changed |
698 changes = set() # set of revisions to be changed |
683 delroots = [] # set of root deleted by this path |
699 delroots = [] # set of root deleted by this path |
684 for phase in (phase for phase in allphases if phase > targetphase): |
700 for phase in (phase for phase in allphases if phase > targetphase): |
685 # filter nodes that are not in a compatible phase already |
701 # filter nodes that are not in a compatible phase already |
686 revs = [rev for rev in revs if self.phase(repo, rev) >= phase] |
702 revs = [rev for rev in revs if self.phase(repo, rev) >= phase] |