changeset 47889:6614ab9f061d

dirstate: forward `remove` call to newer `API` The `_remove` method was only called in the deprecated `remove` function. We merge the two and express it in terms of call to new API methods. Differential Revision: https://phab.mercurial-scm.org/D11314
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 20 Aug 2021 11:23:52 +0200
parents 31a72e5e9200
children 3853e6ee160d
files mercurial/dirstate.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Wed Aug 25 15:15:19 2021 +0200
+++ b/mercurial/dirstate.py	Fri Aug 20 11:23:52 2021 +0200
@@ -858,13 +858,14 @@
                 b'6.0',
                 stacklevel=2,
             )
-        self._remove(f)
-
-    def _remove(self, filename):
-        """internal function to mark a file removed"""
         self._dirty = True
-        self._updatedfiles.add(filename)
-        self._map.removefile(filename, in_merge=self.in_merge)
+        self._updatedfiles.add(f)
+        entry = self._map.get(f)
+        if entry is None:
+            # Assuming we are in a update/merge case
+            self.update_file(f, p1_tracked=True, wc_tracked=False)
+        else:
+            self.set_untracked(f)
 
     def merge(self, f):
         '''Mark a file merged.'''