# HG changeset patch # User Pierre-Yves David # Date 2021-07-08 08:05:23 # Node ID 3d8b639bfbaa6c6a500a12c294e65ab2c684d1c7 # Parent c5190adc17d593f671fc704efa1f667e9edf264e 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 diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -572,10 +572,14 @@ class dirstate(object): 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 @@ class dirstate(object): for f in to_lookup: self.normallookup(f) for f in to_drop: - self.drop(f) + self._drop(f) self._dirty = True