changeset 35082:e6c64744781f

dirstate: move dropping of folded filenames into the dirstate map When dropping files from the dirstate, the corresponding entry in the filefoldmap is also dropped. Move this into the dirstate map object. A future implementation of the dirstate will maintain the filefoldmap differently. Differential Revision: https://phab.mercurial-scm.org/D1343
author Mark Thomas <mbthomas@fb.com>
date Wed, 15 Nov 2017 01:07:42 -0800
parents a947cf872799
children e8ae0b2d88a8
files mercurial/dirstate.py
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Wed Nov 15 01:07:42 2017 -0800
+++ b/mercurial/dirstate.py	Wed Nov 15 01:07:42 2017 -0800
@@ -387,11 +387,6 @@
         return self._map.copymap
 
     def _droppath(self, f):
-        if "filefoldmap" in self._map.__dict__:
-            normed = util.normcase(f)
-            if normed in self._map.filefoldmap:
-                del self._map.filefoldmap[normed]
-
         self._updatedfiles.add(f)
 
     def _addpath(self, f, state, mode, size, mtime):
@@ -1213,9 +1208,6 @@
 
     - `dirfoldmap` is a dict mapping normalized directory names to the
       denormalized form that they appear as in the dirstate.
-
-    Once instantiated, the filefoldmap and dirfoldmap views must be maintained
-    by the caller.
     """
 
     def __init__(self, ui, opener, root):
@@ -1297,6 +1289,9 @@
         """
         if oldstate not in "?r" and "dirs" in self.__dict__:
             self.dirs.delpath(f)
+        if "filefoldmap" in self.__dict__:
+            normed = util.normcase(f)
+            self.filefoldmap.pop(normed, None)
         self._map[f] = dirstatetuple('r', 0, size, 0)
         self.nonnormalset.add(f)
 
@@ -1309,6 +1304,9 @@
         if exists:
             if oldstate != "r" and "dirs" in self.__dict__:
                 self.dirs.delpath(f)
+        if "filefoldmap" in self.__dict__:
+            normed = util.normcase(f)
+            self.filefoldmap.pop(normed, None)
         self.nonnormalset.discard(f)
         return exists