phases: stop modifying localrepo in writeroots()
Also pass the phaseroots being written for clarity. repo._dirtyphases
was already reset to False at call site.
--- a/mercurial/localrepo.py Thu May 10 18:52:04 2012 +0200
+++ b/mercurial/localrepo.py Thu May 10 18:52:07 2012 +0200
@@ -932,7 +932,7 @@
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':
--- a/mercurial/phases.py Thu May 10 18:52:04 2012 +0200
+++ b/mercurial/phases.py Thu May 10 18:52:07 2012 +0200
@@ -156,14 +156,13 @@
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()