equal
deleted
inserted
replaced
204 for phase, roots in enumerate(self.phaseroots): |
204 for phase, roots in enumerate(self.phaseroots): |
205 for h in roots: |
205 for h in roots: |
206 fp.write('%i %s\n' % (phase, hex(h))) |
206 fp.write('%i %s\n' % (phase, hex(h))) |
207 self.dirty = False |
207 self.dirty = False |
208 |
208 |
209 def _updateroots(self, phase, newroots): |
209 def _updateroots(self, phase, newroots, tr): |
210 self.phaseroots[phase] = newroots |
210 self.phaseroots[phase] = newroots |
211 self._phaserevs = None |
211 self._phaserevs = None |
212 self.dirty = True |
212 self.dirty = True |
|
213 |
|
214 tr.addfilegenerator('phase', ('phaseroots',), self._write) |
213 |
215 |
214 def advanceboundary(self, repo, tr, targetphase, nodes): |
216 def advanceboundary(self, repo, tr, targetphase, nodes): |
215 # Be careful to preserve shallow-copied values: do not update |
217 # Be careful to preserve shallow-copied values: do not update |
216 # phaseroots values, replace them. |
218 # phaseroots values, replace them. |
217 |
219 |
225 break # no roots to move anymore |
227 break # no roots to move anymore |
226 olds = self.phaseroots[phase] |
228 olds = self.phaseroots[phase] |
227 roots = set(ctx.node() for ctx in repo.set( |
229 roots = set(ctx.node() for ctx in repo.set( |
228 'roots((%ln::) - (%ln::%ln))', olds, olds, nodes)) |
230 'roots((%ln::) - (%ln::%ln))', olds, olds, nodes)) |
229 if olds != roots: |
231 if olds != roots: |
230 self._updateroots(phase, roots) |
232 self._updateroots(phase, roots, tr) |
231 # some roots may need to be declared for lower phases |
233 # some roots may need to be declared for lower phases |
232 delroots.extend(olds - roots) |
234 delroots.extend(olds - roots) |
233 # declare deleted root in the target phase |
235 # declare deleted root in the target phase |
234 if targetphase != 0: |
236 if targetphase != 0: |
235 self.retractboundary(repo, tr, targetphase, delroots) |
237 self.retractboundary(repo, tr, targetphase, delroots) |
248 raise util.Abort(_('cannot change null revision phase')) |
250 raise util.Abort(_('cannot change null revision phase')) |
249 currentroots = currentroots.copy() |
251 currentroots = currentroots.copy() |
250 currentroots.update(newroots) |
252 currentroots.update(newroots) |
251 ctxs = repo.set('roots(%ln::)', currentroots) |
253 ctxs = repo.set('roots(%ln::)', currentroots) |
252 currentroots.intersection_update(ctx.node() for ctx in ctxs) |
254 currentroots.intersection_update(ctx.node() for ctx in ctxs) |
253 self._updateroots(targetphase, currentroots) |
255 self._updateroots(targetphase, currentroots, tr) |
254 repo.invalidatevolatilesets() |
256 repo.invalidatevolatilesets() |
255 |
257 |
256 def filterunknown(self, repo): |
258 def filterunknown(self, repo): |
257 """remove unknown nodes from the phase boundary |
259 """remove unknown nodes from the phase boundary |
258 |
260 |