Patchwork D11564: dirstatemap: introduce a common base for the dirstatemap class

login
register
mail settings
Submitter phabricator
Date Oct. 2, 2021, 3:04 p.m.
Message ID <differential-rev-PHID-DREV-fs7ptfoakg3a7ysynnd3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49888/
State Superseded
Headers show

Comments

phabricator - Oct. 2, 2021, 3:04 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11564

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -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