##// END OF EJS Templates
phases: convert registernew users to use revision sets...
Joerg Sonnenberger -
r46375:5d65e04b default
parent child Browse files
Show More
@@ -398,7 +398,7 b' class mercurial_sink(common.converter_si'
398 ctx = self.repo[node]
398 ctx = self.repo[node]
399 if ctx.phase() < phases.draft:
399 if ctx.phase() < phases.draft:
400 phases.registernew(
400 phases.registernew(
401 self.repo, tr, phases.draft, [ctx.node()]
401 self.repo, tr, phases.draft, [ctx.rev()]
402 )
402 )
403
403
404 text = b"(octopus merge fixup)\n"
404 text = b"(octopus merge fixup)\n"
@@ -443,7 +443,7 b' class cg1unpacker(object):'
443 # ignored.
443 # ignored.
444 targetphase = phaseall = phases.draft
444 targetphase = phaseall = phases.draft
445 if added:
445 if added:
446 phases.registernew(repo, tr, targetphase, [], revs=added)
446 phases.registernew(repo, tr, targetphase, added)
447 if phaseall is not None:
447 if phaseall is not None:
448 phases.advanceboundary(repo, tr, phaseall, cgnodes, revs=added)
448 phases.advanceboundary(repo, tr, phaseall, cgnodes, revs=added)
449 cgnodes = []
449 cgnodes = []
@@ -105,7 +105,7 b' def commitctx(repo, ctx, error=False, or'
105 # be compliant anyway
105 # be compliant anyway
106 #
106 #
107 # if minimal phase was 0 we don't need to retract anything
107 # if minimal phase was 0 we don't need to retract anything
108 phases.registernew(repo, tr, targetphase, [n])
108 phases.registernew(repo, tr, targetphase, [repo[n].rev()])
109 return n
109 return n
110
110
111
111
@@ -79,7 +79,9 b' def pull(pullop):'
79 # Ensure all new changesets are draft by default. If the repo is
79 # Ensure all new changesets are draft by default. If the repo is
80 # publishing, the phase will be adjusted by the loop below.
80 # publishing, the phase will be adjusted by the loop below.
81 if csetres[b'added']:
81 if csetres[b'added']:
82 phases.registernew(repo, tr, phases.draft, csetres[b'added'])
82 phases.registernew(
83 repo, tr, phases.draft, [repo[n].rev() for n in csetres[b'added']]
84 )
83
85
84 # And adjust the phase of all changesets accordingly.
86 # And adjust the phase of all changesets accordingly.
85 for phasenumber, phase in phases.phasenames.items():
87 for phasenumber, phase in phases.phasenames.items():
@@ -510,18 +510,13 b' class phasecache(object):'
510 tr.addfilegenerator(b'phase', (b'phaseroots',), self._write)
510 tr.addfilegenerator(b'phase', (b'phaseroots',), self._write)
511 tr.hookargs[b'phases_moved'] = b'1'
511 tr.hookargs[b'phases_moved'] = b'1'
512
512
513 def registernew(self, repo, tr, targetphase, nodes, revs=None):
513 def registernew(self, repo, tr, targetphase, revs):
514 if revs is None:
515 revs = []
516 repo = repo.unfiltered()
514 repo = repo.unfiltered()
517 self._retractboundary(repo, tr, targetphase, nodes, revs=revs)
515 self._retractboundary(repo, tr, targetphase, [], revs=revs)
518 if tr is not None and b'phases' in tr.changes:
516 if tr is not None and b'phases' in tr.changes:
519 phasetracking = tr.changes[b'phases']
517 phasetracking = tr.changes[b'phases']
520 torev = repo.changelog.rev
521 phase = self.phase
518 phase = self.phase
522 revs = [torev(node) for node in nodes] + sorted(revs)
519 for rev in sorted(revs):
523 revs.sort()
524 for rev in revs:
525 revphase = phase(repo, rev)
520 revphase = phase(repo, rev)
526 _trackphasechange(phasetracking, rev, None, revphase)
521 _trackphasechange(phasetracking, rev, None, revphase)
527 repo.invalidatevolatilesets()
522 repo.invalidatevolatilesets()
@@ -722,16 +717,14 b' def retractboundary(repo, tr, targetphas'
722 repo._phasecache.replace(phcache)
717 repo._phasecache.replace(phcache)
723
718
724
719
725 def registernew(repo, tr, targetphase, nodes, revs=None):
720 def registernew(repo, tr, targetphase, revs):
726 """register a new revision and its phase
721 """register a new revision and its phase
727
722
728 Code adding revisions to the repository should use this function to
723 Code adding revisions to the repository should use this function to
729 set new changeset in their target phase (or higher).
724 set new changeset in their target phase (or higher).
730 """
725 """
731 if revs is None:
732 revs = []
733 phcache = repo._phasecache.copy()
726 phcache = repo._phasecache.copy()
734 phcache.registernew(repo, tr, targetphase, nodes, revs=revs)
727 phcache.registernew(repo, tr, targetphase, revs)
735 repo._phasecache.replace(phcache)
728 repo._phasecache.replace(phcache)
736
729
737
730
General Comments 0
You need to be logged in to leave comments. Login now