changeset 48119:aec5b0981c26

dirstatemap: introduce a common base for the dirstatemap class We have two dirstatemaps class. One for the python version of the dirstate map and one for the Rust version (that has a python wrapper to deal with some aspect of it). We end up with duplicated code between them, so we introduce a common base class to start migrating common code in them. Differential Revision: https://phab.mercurial-scm.org/D11564
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 01 Oct 2021 16:14:29 +0200
parents 5105a9975407
children fe6617715464
files mercurial/dirstatemap.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstatemap.py	Tue Sep 28 15:11:22 2021 -0700
+++ b/mercurial/dirstatemap.py	Fri Oct 01 16:14:29 2021 +0200
@@ -35,7 +35,14 @@
 rangemask = 0x7FFFFFFF
 
 
-class dirstatemap(object):
+class _dirstatemapcommon(object):
+    """
+    Methods that are identical for both implementations of the dirstatemap
+    class, with and without Rust extensions enabled.
+    """
+
+
+class dirstatemap(_dirstatemapcommon):
     """Map encapsulating the dirstate's contents.
 
     The dirstate contains the following state:
@@ -460,7 +467,7 @@
 
 if rustmod is not None:
 
-    class dirstatemap(object):
+    class dirstatemap(_dirstatemapcommon):
         def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
             self._use_dirstate_v2 = use_dirstate_v2
             self._nodeconstants = nodeconstants