Patchwork D11570: dirstatemap: create `_dirs_incr/_dirs_decr` methods on the common class

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

Comments

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

REVISION SUMMARY
  The Rust wrapper does not need them. However having a default, no-op,
  implementation will help use to write code used by both implementation.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -79,6 +79,25 @@ 
     def __getitem__(self, item):
         return self._map[item]
 
+    ### sub-class utility method
+    #
+    # Use to allow for generic implementation of some method while still coping
+    # with minor difference between implementation.
+
+    def _dirs_incr(self, filename, old_entry=None):
+        """incremente the dirstate counter if applicable
+
+        This might be a no-op for some subclass who deal with directory
+        tracking in a different way.
+        """
+
+    def _dirs_decr(self, filename, old_entry=None, remove_variant=False):
+        """decremente the dirstate counter if applicable
+
+        This might be a no-op for some subclass who deal with directory
+        tracking in a different way.
+        """
+
 
 class dirstatemap(_dirstatemapcommon):
     """Map encapsulating the dirstate's contents.