[PATCH 5 of 5] phases: stop modifying localrepo in writeroots()

Patrick Mezard patrick at mezard.eu
Thu May 10 12:05:16 CDT 2012


# HG changeset patch
# User Patrick Mezard <patrick at mezard.eu>
# Date 1336668727 -7200
# Node ID ffbe4468b4976a987fdb5d762cfebbcff94c8d05
# Parent  c2ac2df839ad1eac79c152fa58c2fb2bd3f4f9c5
phases: stop modifying localrepo in writeroots()

Also pass the phaseroots being written for clarity. repo._dirtyphases
was already reset to False at call site.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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':
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -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()
 


More information about the Mercurial-devel mailing list