# HG changeset patch # User Durham Goode # Date 2017-10-05 18:34:41 # Node ID e2214632c3a2caf22906dc6622a5877d3a9864ec # Parent e159f217230e0d35f8ce6cdd749f31798e7a9aa2 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 diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -739,12 +739,10 @@ class dirstate(object): 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 @@ class dirstatemap(object): 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