dirstate: make map implementation overridable
Other implementations of dirstate will want to replace the class used for the
dirstate map. Allow this to happen by making the class an attribute of the
dirstate.
Differential Revision: https://phab.mercurial-scm.org/D1347
--- a/mercurial/dirstate.py Wed Nov 15 01:07:42 2017 -0800
+++ b/mercurial/dirstate.py Wed Nov 15 01:07:42 2017 -0800
@@ -80,6 +80,7 @@
self._plchangecallbacks = {}
self._origpl = None
self._updatedfiles = set()
+ self._mapcls = dirstatemap
@contextlib.contextmanager
def parentchange(self):
@@ -128,7 +129,7 @@
@propertycache
def _map(self):
"""Return the dirstate contents (see documentation for dirstatemap)."""
- self._map = dirstatemap(self._ui, self._opener, self._root)
+ self._map = self._mapcls(self._ui, self._opener, self._root)
return self._map
@property