Patchwork D11573: dirstatemap: add a common `_insert_entry` method for dirstatemap

login
register
mail settings
Submitter phabricator
Date Oct. 2, 2021, 3:05 p.m.
Message ID <differential-rev-PHID-DREV-t7frxfadkohaeta4heds-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49897/
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
  This method is called to add a new DirstateItem to the map.
  
  Each variant have a different implementation (which is … the point).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -101,6 +101,12 @@ 
     def _refresh_entry(self, f, entry):
         """record updated state of an entry"""
 
+    def _insert_entry(self, f, entry):
+        """add a new dirstate entry (or replace an unrelated one)
+
+        The fact it is actually new is the responsability of the caller
+        """
+
     ### method to manipulate the entries
 
     def set_untracked(self, f):
@@ -403,6 +409,9 @@ 
         if not entry.any_tracked:
             self._map.pop(f, None)
 
+    def _insert_entry(self, f, entry):
+        self._map[f] = entry
+
     def set_possibly_dirty(self, filename):
         """record that the current state of the file on disk is unknown"""
         self[filename].set_possibly_dirty()
@@ -784,6 +793,9 @@ 
             else:
                 self._map.addfile(f, entry)
 
+        def _insert_entry(self, f, entry):
+            self._map.addfile(f, entry)
+
         def set_possibly_dirty(self, filename):
             """record that the current state of the file on disk is unknown"""
             entry = self[filename]