346 if targetphase != 0: |
346 if targetphase != 0: |
347 self._retractboundary(repo, tr, targetphase, delroots) |
347 self._retractboundary(repo, tr, targetphase, delroots) |
348 repo.invalidatevolatilesets() |
348 repo.invalidatevolatilesets() |
349 |
349 |
350 def retractboundary(self, repo, tr, targetphase, nodes): |
350 def retractboundary(self, repo, tr, targetphase, nodes): |
351 self._retractboundary(repo, tr, targetphase, nodes) |
351 oldroots = self.phaseroots[:targetphase + 1] |
|
352 if tr is None: |
|
353 phasetracking = None |
|
354 else: |
|
355 phasetracking = tr.changes.get('phases') |
|
356 repo = repo.unfiltered() |
|
357 if (self._retractboundary(repo, tr, targetphase, nodes) |
|
358 and phasetracking is not None): |
|
359 |
|
360 # find the affected revisions |
|
361 new = self.phaseroots[targetphase] |
|
362 old = oldroots[targetphase] |
|
363 affected = set(repo.revs('(%ln::) - (%ln::)', new, old)) |
|
364 |
|
365 # find the phase of the affected revision |
|
366 for phase in xrange(targetphase, -1, -1): |
|
367 if phase: |
|
368 roots = oldroots[phase] |
|
369 revs = set(repo.revs('%ln::%ld', roots, affected)) |
|
370 affected -= revs |
|
371 else: # public phase |
|
372 revs = affected |
|
373 for r in revs: |
|
374 _trackphasechange(phasetracking, r, phase, targetphase) |
352 repo.invalidatevolatilesets() |
375 repo.invalidatevolatilesets() |
353 |
376 |
354 def _retractboundary(self, repo, tr, targetphase, nodes): |
377 def _retractboundary(self, repo, tr, targetphase, nodes): |
355 # Be careful to preserve shallow-copied values: do not update |
378 # Be careful to preserve shallow-copied values: do not update |
356 # phaseroots values, replace them. |
379 # phaseroots values, replace them. |