##// END OF EJS Templates
advanceboundary: add dryrun parameter...
Sushil khanchi -
r38218:36ba5dba default
parent child Browse files
Show More
@@ -354,10 +354,14 b' class phasecache(object):'
354 _trackphasechange(phasetracking, rev, None, revphase)
354 _trackphasechange(phasetracking, rev, None, revphase)
355 repo.invalidatevolatilesets()
355 repo.invalidatevolatilesets()
356
356
357 def advanceboundary(self, repo, tr, targetphase, nodes):
357 def advanceboundary(self, repo, tr, targetphase, nodes, dryrun=None):
358 """Set all 'nodes' to phase 'targetphase'
358 """Set all 'nodes' to phase 'targetphase'
359
359
360 Nodes with a phase lower than 'targetphase' are not affected.
360 Nodes with a phase lower than 'targetphase' are not affected.
361
362 If dryrun is True, no actions will be performed
363
364 Returns a set of revs whose phase is changed or should be changed
361 """
365 """
362 # Be careful to preserve shallow-copied values: do not update
366 # Be careful to preserve shallow-copied values: do not update
363 # phaseroots values, replace them.
367 # phaseroots values, replace them.
@@ -368,6 +372,7 b' class phasecache(object):'
368
372
369 repo = repo.unfiltered()
373 repo = repo.unfiltered()
370
374
375 changes = set() # set of revisions to be changed
371 delroots = [] # set of root deleted by this path
376 delroots = [] # set of root deleted by this path
372 for phase in xrange(targetphase + 1, len(allphases)):
377 for phase in xrange(targetphase + 1, len(allphases)):
373 # filter nodes that are not in a compatible phase already
378 # filter nodes that are not in a compatible phase already
@@ -379,6 +384,9 b' class phasecache(object):'
379 olds = self.phaseroots[phase]
384 olds = self.phaseroots[phase]
380
385
381 affected = repo.revs('%ln::%ln', olds, nodes)
386 affected = repo.revs('%ln::%ln', olds, nodes)
387 changes.update(affected)
388 if dryrun:
389 continue
382 for r in affected:
390 for r in affected:
383 _trackphasechange(phasetracking, r, self.phase(repo, r),
391 _trackphasechange(phasetracking, r, self.phase(repo, r),
384 targetphase)
392 targetphase)
@@ -389,10 +397,12 b' class phasecache(object):'
389 self._updateroots(phase, roots, tr)
397 self._updateroots(phase, roots, tr)
390 # some roots may need to be declared for lower phases
398 # some roots may need to be declared for lower phases
391 delroots.extend(olds - roots)
399 delroots.extend(olds - roots)
400 if not dryrun:
392 # declare deleted root in the target phase
401 # declare deleted root in the target phase
393 if targetphase != 0:
402 if targetphase != 0:
394 self._retractboundary(repo, tr, targetphase, delroots)
403 self._retractboundary(repo, tr, targetphase, delroots)
395 repo.invalidatevolatilesets()
404 repo.invalidatevolatilesets()
405 return changes
396
406
397 def retractboundary(self, repo, tr, targetphase, nodes):
407 def retractboundary(self, repo, tr, targetphase, nodes):
398 oldroots = self.phaseroots[:targetphase + 1]
408 oldroots = self.phaseroots[:targetphase + 1]
@@ -480,16 +490,24 b' class phasecache(object):'
480 # (see branchmap one)
490 # (see branchmap one)
481 self.invalidate()
491 self.invalidate()
482
492
483 def advanceboundary(repo, tr, targetphase, nodes):
493 def advanceboundary(repo, tr, targetphase, nodes, dryrun=None):
484 """Add nodes to a phase changing other nodes phases if necessary.
494 """Add nodes to a phase changing other nodes phases if necessary.
485
495
486 This function move boundary *forward* this means that all nodes
496 This function move boundary *forward* this means that all nodes
487 are set in the target phase or kept in a *lower* phase.
497 are set in the target phase or kept in a *lower* phase.
488
498
489 Simplify boundary to contains phase roots only."""
499 Simplify boundary to contains phase roots only.
500
501 If dryrun is True, no actions will be performed
502
503 Returns a set of revs whose phase is changed or should be changed
504 """
490 phcache = repo._phasecache.copy()
505 phcache = repo._phasecache.copy()
491 phcache.advanceboundary(repo, tr, targetphase, nodes)
506 changes = phcache.advanceboundary(repo, tr, targetphase, nodes,
507 dryrun=dryrun)
508 if not dryrun:
492 repo._phasecache.replace(phcache)
509 repo._phasecache.replace(phcache)
510 return changes
493
511
494 def retractboundary(repo, tr, targetphase, nodes):
512 def retractboundary(repo, tr, targetphase, nodes):
495 """Set nodes back to a phase changing other nodes phases if
513 """Set nodes back to a phase changing other nodes phases if
General Comments 0
You need to be logged in to leave comments. Login now