diff mercurial/dirstate.py @ 47988:d459c6b84961

dirstate: inline the last two `_drop` usage The function is small and having the associated code directly inline help use to cleanup the dirstate API. Differential Revision: https://phab.mercurial-scm.org/D11428
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 15 Sep 2021 10:20:25 +0200
parents dd267f16042f
children 87b3010c08e0
line wrap: on
line diff
--- a/mercurial/dirstate.py	Wed Sep 15 10:02:11 2021 +0200
+++ b/mercurial/dirstate.py	Wed Sep 15 10:20:25 2021 +0200
@@ -560,7 +560,9 @@
             possibly_dirty = True
         elif not (p1_tracked or wc_tracked):
             # the file is no longer relevant to anyone
-            self._drop(filename)
+            if self._map.dropfile(filename):
+                self._dirty = True
+                self._updatedfiles.add(filename)
         elif (not p1_tracked) and wc_tracked:
             if entry is not None and entry.added:
                 return  # avoid dropping copy information (maybe?)
@@ -742,12 +744,6 @@
         self._addpath(f, possibly_dirty=True)
         self._map.copymap.pop(f, None)
 
-    def _drop(self, filename):
-        """internal function to drop a file from the dirstate"""
-        if self._map.dropfile(filename):
-            self._dirty = True
-            self._updatedfiles.add(filename)
-
     def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
         if exists is None:
             exists = os.path.lexists(os.path.join(self._root, path))
@@ -860,7 +856,8 @@
         for f in to_lookup:
             self._normallookup(f)
         for f in to_drop:
-            self._drop(f)
+            if self._map.dropfile(f):
+                self._updatedfiles.add(f)
 
         self._dirty = True