##// 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 354 _trackphasechange(phasetracking, rev, None, revphase)
355 355 repo.invalidatevolatilesets()
356 356
357 def advanceboundary(self, repo, tr, targetphase, nodes):
357 def advanceboundary(self, repo, tr, targetphase, nodes, dryrun=None):
358 358 """Set all 'nodes' to phase 'targetphase'
359 359
360 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 366 # Be careful to preserve shallow-copied values: do not update
363 367 # phaseroots values, replace them.
@@ -368,6 +372,7 b' class phasecache(object):'
368 372
369 373 repo = repo.unfiltered()
370 374
375 changes = set() # set of revisions to be changed
371 376 delroots = [] # set of root deleted by this path
372 377 for phase in xrange(targetphase + 1, len(allphases)):
373 378 # filter nodes that are not in a compatible phase already
@@ -379,6 +384,9 b' class phasecache(object):'
379 384 olds = self.phaseroots[phase]
380 385
381 386 affected = repo.revs('%ln::%ln', olds, nodes)
387 changes.update(affected)
388 if dryrun:
389 continue
382 390 for r in affected:
383 391 _trackphasechange(phasetracking, r, self.phase(repo, r),
384 392 targetphase)
@@ -389,10 +397,12 b' class phasecache(object):'
389 397 self._updateroots(phase, roots, tr)
390 398 # some roots may need to be declared for lower phases
391 399 delroots.extend(olds - roots)
392 # declare deleted root in the target phase
393 if targetphase != 0:
394 self._retractboundary(repo, tr, targetphase, delroots)
395 repo.invalidatevolatilesets()
400 if not dryrun:
401 # declare deleted root in the target phase
402 if targetphase != 0:
403 self._retractboundary(repo, tr, targetphase, delroots)
404 repo.invalidatevolatilesets()
405 return changes
396 406
397 407 def retractboundary(self, repo, tr, targetphase, nodes):
398 408 oldroots = self.phaseroots[:targetphase + 1]
@@ -480,16 +490,24 b' class phasecache(object):'
480 490 # (see branchmap one)
481 491 self.invalidate()
482 492
483 def advanceboundary(repo, tr, targetphase, nodes):
493 def advanceboundary(repo, tr, targetphase, nodes, dryrun=None):
484 494 """Add nodes to a phase changing other nodes phases if necessary.
485 495
486 496 This function move boundary *forward* this means that all nodes
487 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 505 phcache = repo._phasecache.copy()
491 phcache.advanceboundary(repo, tr, targetphase, nodes)
492 repo._phasecache.replace(phcache)
506 changes = phcache.advanceboundary(repo, tr, targetphase, nodes,
507 dryrun=dryrun)
508 if not dryrun:
509 repo._phasecache.replace(phcache)
510 return changes
493 511
494 512 def retractboundary(repo, tr, targetphase, nodes):
495 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