Patchwork D11314: dirstate: forward `remove` call to newer `API`

login
register
mail settings
Submitter phabricator
Date Aug. 21, 2021, 9:56 a.m.
Message ID <differential-rev-PHID-DREV-vee6baj4qxr2vuzfhp3c-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49628/
State Superseded
Headers show

Comments

phabricator - Aug. 21, 2021, 9:56 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -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.'''