Patchwork D11011: dirstate: introduce and internal `_remove` method

login
register
mail settings
Submitter phabricator
Date July 7, 2021, 9:20 p.m.
Message ID <differential-rev-PHID-DREV-jxa2kzxrl5gwhr3r7si7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49325/
State Superseded
Headers show

Comments

phabricator - July 7, 2021, 9:20 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We want to reserver `dirstate.remove` to `hg remove`-like case and move to a
  clear API for update of the dirstate coming from update/merge. The first step
  is to introduce an internal function for this kind of operation.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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