phases: stop modifying localrepo in writeroots()
authorPatrick Mezard <patrick@mezard.eu>
Thu, 10 May 2012 18:52:07 +0200
changeset 16626 503e674fb545
parent 16625 df9df747070d
child 16627 38c45a99be0b
phases: stop modifying localrepo in writeroots() Also pass the phaseroots being written for clarity. repo._dirtyphases was already reset to False at call site.
mercurial/localrepo.py
mercurial/phases.py
--- 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()