changeset 47591:3d8b639bfbaa

dirstate: introduce an internal `_drop` method We want to split current user of `dirstate.drop` between `hg rm`-like cases and update of the dirstate coming from update/merge. To do this we will introduce new API. The first step is to introduces an internal function that these new API migh use (or not use) to distinct between the migrated users and the others. Differential Revision: https://phab.mercurial-scm.org/D11023
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Jul 2021 10:05:23 +0200
parents c5190adc17d5
children 0f5c203eb5ab
files mercurial/dirstate.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Wed Jul 07 19:32:22 2021 +0200
+++ b/mercurial/dirstate.py	Thu Jul 08 10:05:23 2021 +0200
@@ -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