changeset 34673:e2214632c3a2

dirstate: move write into dirstatemap As part of separating the dirstate business logic from the dirstate storage logic, let's move the serialization code down into dirstatemap. Differential Revision: https://phab.mercurial-scm.org/D978
author Durham Goode <durham@fb.com>
date Thu, 05 Oct 2017 11:34:41 -0700
parents e159f217230e
children 60927b19ed65
files mercurial/dirstate.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Thu Oct 05 11:34:41 2017 -0700
+++ b/mercurial/dirstate.py	Thu Oct 05 11:34:41 2017 -0700
@@ -739,12 +739,10 @@
                     now = end # trust our estimate that the end is near now
                     break
 
-        st.write(parsers.pack_dirstate(self._map._map, self._map.copymap,
-                                       self._pl, now))
+        self._map.write(st, now)
         self._nonnormalset, self._otherparentset = self._map.nonnormalentries()
-        st.close()
         self._lastnormaltime = 0
-        self._dirty = self._map._dirtyparents = False
+        self._dirty = False
 
     def _dirignore(self, f):
         if f == '.':
@@ -1401,3 +1399,9 @@
         p = parse_dirstate(self._map, self.copymap, st)
         if not self._dirtyparents:
             self.setparents(*p)
+
+    def write(self, st, now):
+        st.write(parsers.pack_dirstate(self._map, self.copymap,
+                                       self.parents(), now))
+        st.close()
+        self._dirtyparents = False