dirstate: introduce an internal `_remove` method
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 07 Jul 2021 19:32:22 +0200
changeset 47590 c5190adc17d5
parent 47589 f5c24c124e07
child 47591 3d8b639bfbaa
dirstate: introduce an internal `_remove` method We want to split current user of `dirstate.remove` 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/D11011
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Wed Jul 07 19:31:52 2021 +0200
+++ b/mercurial/dirstate.py	Wed Jul 07 19:32:22 2021 +0200
@@ -555,10 +555,14 @@
         self._map.copymap.pop(filename, None)
 
     def remove(self, f):
-        '''Mark a file removed.'''
+        '''Mark a file removed'''
+        self._remove(f)
+
+    def _remove(self, filename):
+        """internal function to mark a file removed"""
         self._dirty = True
-        self._updatedfiles.add(f)
-        self._map.removefile(f, in_merge=self.in_merge)
+        self._updatedfiles.add(filename)
+        self._map.removefile(filename, in_merge=self.in_merge)
 
     def merge(self, f):
         '''Mark a file merged.'''