changeset 47998:938a7769050c

dirstate: support file tracked nowhere in `reset_state` This let the dirstatemap decide when to drop files. Differential Revision: https://phab.mercurial-scm.org/D11438
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 15 Sep 2021 18:36:59 +0200
parents 70547a7d5930
children bac82c2ce858
files mercurial/dirstatemap.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstatemap.py	Wed Sep 15 18:30:06 2021 +0200
+++ b/mercurial/dirstatemap.py	Wed Sep 15 18:36:59 2021 +0200
@@ -180,8 +180,8 @@
     def reset_state(
         self,
         filename,
-        wc_tracked,
-        p1_tracked,
+        wc_tracked=False,
+        p1_tracked=False,
         p2_tracked=False,
         merged=False,
         clean_p1=False,
@@ -206,7 +206,10 @@
         self.copymap.pop(filename, None)
 
         if not (p1_tracked or p2_tracked or wc_tracked):
-            self.dropfile(filename)
+            old_entry = self._map.pop(filename, None)
+            self._dirs_decr(filename, old_entry=old_entry)
+            self.nonnormalset.discard(filename)
+            self.copymap.pop(filename, None)
             return
         elif merged:
             # XXX might be merged and removed ?
@@ -576,8 +579,8 @@
         def reset_state(
             self,
             filename,
-            wc_tracked,
-            p1_tracked,
+            wc_tracked=False,
+            p1_tracked=False,
             p2_tracked=False,
             merged=False,
             clean_p1=False,