# HG changeset patch # User Durham Goode # Date 1509059731 25200 # Node ID 0217f75b6e59cc098f99b6238ea50e121bcefd42 # Parent fd78276948b486d50e1ba8c36c843aaf0780b6a0 dirstate: move clear onto dirstatemap class A future diff will move the lazy loading aspect of dirstate to the dirstatemap class. This means it requires a slightly different strategy of clearing than just reinstantiating the object (since just reinstantiating the object will lazily load the on disk data again later instead of remaining permanently empty). So let's give it it's own clear function. Differential Revision: https://phab.mercurial-scm.org/D1252 diff -r fd78276948b4 -r 0217f75b6e59 mercurial/dirstate.py --- a/mercurial/dirstate.py Fri Oct 27 18:19:07 2017 +0200 +++ b/mercurial/dirstate.py Thu Oct 26 16:15:31 2017 -0700 @@ -593,8 +593,7 @@ return path def clear(self): - self._map = dirstatemap(self._ui, self._opener, self._root) - self._map.setparents(nullid, nullid) + self._map.clear() self._lastnormaltime = 0 self._updatedfiles.clear() self._dirty = True @@ -1210,6 +1209,11 @@ # for consistent view between _pl() and _read() invocations self._pendingmode = None + def clear(self): + self._map = {} + self.copymap = {} + self.setparents(nullid, nullid) + def iteritems(self): return self._map.iteritems()