Patchwork D11023: dirstate: introduce and internal `_drop` method

login
register
mail settings
Submitter phabricator
Date July 8, 2021, 8:16 a.m.
Message ID <differential-rev-PHID-DREV-6i6mbmtvoj346e3zrx5o-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49337/
State Superseded
Headers show

Comments

phabricator - July 8, 2021, 8:16 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  dropping a file from the dirstate is decision that the dirstate itself should be
  able to move. So we will slowly migrate caller to more appropriate API. In order
  to easily find caller from current (soon, old) API, we introduce an internal
  method that internal dirstate code can call when necessary.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -572,10 +572,14 @@ 
 
     def drop(self, f):
         '''Drop a file from the dirstate'''
-        if self._map.dropfile(f):
+        self._drop(f)
+
+    def _drop(self, filename):
+        """internal function to drop a file from the dirstate"""
+        if self._map.dropfile(filename):
             self._dirty = True
-            self._updatedfiles.add(f)
-            self._map.copymap.pop(f, None)
+            self._updatedfiles.add(filename)
+            self._map.copymap.pop(filename, None)
 
     def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
         if exists is None:
@@ -689,7 +693,7 @@ 
         for f in to_lookup:
             self.normallookup(f)
         for f in to_drop:
-            self.drop(f)
+            self._drop(f)
 
         self._dirty = True