diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -932,7 +932,7 @@ class localrepository(repo.repository): def unlock(): self.store.write() if self._dirtyphases: - phases.writeroots(self) + phases.writeroots(self, self._phaseroots) self._dirtyphases = False for k, ce in self._filecache.items(): if k == 'dirstate': diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -156,14 +156,13 @@ def readroots(repo, phasedefaults=None): dirty = True return roots, dirty -def writeroots(repo): +def writeroots(repo, phaseroots): """Write phase roots from disk""" f = repo.sopener('phaseroots', 'w', atomictemp=True) try: - for phase, roots in enumerate(repo._phaseroots): + for phase, roots in enumerate(phaseroots): for h in roots: f.write('%i %s\n' % (phase, hex(h))) - repo._dirtyphases = False finally: f.close()