Patchwork D1343: dirstate: move dropping of folded filenames into the dirstate map

login
register
mail settings
Submitter phabricator
Date Nov. 13, 2017, 12:18 p.m.
Message ID <9ea6140000472e2745be7a15fb9d5376@localhost.localdomain>
Download mbox | patch
Permalink /patch/25523/
State Not Applicable
Headers show

Comments

phabricator - Nov. 13, 2017, 12:18 p.m.
mbthomas updated this revision to Diff 3440.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1343?vs=3343&id=3440

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: mbthomas, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -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):
@@ -1215,9 +1210,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):
@@ -1299,6 +1291,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)
 
@@ -1312,6 +1307,9 @@ 
             if oldstate != "r" and "dirs" in self.__dict__:
                 self.dirs.delpath(f)
             del self._map[f]
+        if "filefoldmap" in self.__dict__:
+            normed = util.normcase(f)
+            self.filefoldmap.pop(normed, None)
         self.nonnormalset.discard(f)
         return exists