changeset 16626:503e674fb545

phases: stop modifying localrepo in writeroots() Also pass the phaseroots being written for clarity. repo._dirtyphases was already reset to False at call site.
author Patrick Mezard <patrick@mezard.eu>
date Thu, 10 May 2012 18:52:07 +0200
parents df9df747070d
children 38c45a99be0b
files mercurial/localrepo.py mercurial/phases.py
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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()