diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -398,7 +398,7 @@ ctx = self.repo[node] if ctx.phase() < phases.draft: phases.registernew( - self.repo, tr, phases.draft, [ctx.node()] + self.repo, tr, phases.draft, [ctx.rev()] ) text = b"(octopus merge fixup)\n" diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -443,7 +443,7 @@ # ignored. targetphase = phaseall = phases.draft if added: - phases.registernew(repo, tr, targetphase, [], revs=added) + phases.registernew(repo, tr, targetphase, added) if phaseall is not None: phases.advanceboundary(repo, tr, phaseall, cgnodes, revs=added) cgnodes = [] diff --git a/mercurial/commit.py b/mercurial/commit.py --- a/mercurial/commit.py +++ b/mercurial/commit.py @@ -105,7 +105,7 @@ # be compliant anyway # # if minimal phase was 0 we don't need to retract anything - phases.registernew(repo, tr, targetphase, [n]) + phases.registernew(repo, tr, targetphase, [repo[n].rev()]) return n diff --git a/mercurial/exchangev2.py b/mercurial/exchangev2.py --- a/mercurial/exchangev2.py +++ b/mercurial/exchangev2.py @@ -79,7 +79,9 @@ # Ensure all new changesets are draft by default. If the repo is # publishing, the phase will be adjusted by the loop below. if csetres[b'added']: - phases.registernew(repo, tr, phases.draft, csetres[b'added']) + phases.registernew( + repo, tr, phases.draft, [repo[n].rev() for n in csetres[b'added']] + ) # And adjust the phase of all changesets accordingly. for phasenumber, phase in phases.phasenames.items(): diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -510,16 +510,13 @@ tr.addfilegenerator(b'phase', (b'phaseroots',), self._write) tr.hookargs[b'phases_moved'] = b'1' - def registernew(self, repo, tr, targetphase, nodes, revs=[]): + def registernew(self, repo, tr, targetphase, revs): repo = repo.unfiltered() - self._retractboundary(repo, tr, targetphase, nodes, revs=revs) + self._retractboundary(repo, tr, targetphase, [], revs=revs) if tr is not None and b'phases' in tr.changes: phasetracking = tr.changes[b'phases'] - torev = repo.changelog.rev phase = self.phase - revs = [torev(node) for node in nodes] + sorted(revs) - revs.sort() - for rev in revs: + for rev in sorted(revs): revphase = phase(repo, rev) _trackphasechange(phasetracking, rev, None, revphase) repo.invalidatevolatilesets() @@ -714,14 +711,14 @@ repo._phasecache.replace(phcache) -def registernew(repo, tr, targetphase, nodes, revs=[]): +def registernew(repo, tr, targetphase, revs): """register a new revision and its phase Code adding revisions to the repository should use this function to set new changeset in their target phase (or higher). """ phcache = repo._phasecache.copy() - phcache.registernew(repo, tr, targetphase, nodes, revs=revs) + phcache.registernew(repo, tr, targetphase, revs) repo._phasecache.replace(phcache)