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

login
register
mail settings
Submitter phabricator
Date Nov. 8, 2017, 5:31 p.m.
Message ID <differential-rev-PHID-DREV-3r7b7ufhdmbsm4jmz2t4-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25427/
State Superseded
Headers show

Comments

phabricator - Nov. 8, 2017, 5:31 p.m.
mbthomas created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: mbthomas, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 13, 2017, 10:46 p.m.
durin42 added a comment.


  btw I'm dubious of the 'filefoldmap' in self.__dict__ checks, as that very much looks like it should be an invariant now

REPOSITORY
  rHG Mercurial

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

To: mbthomas, #hg-reviewers, durin42
Cc: mercurial-devel
phabricator - Nov. 14, 2017, 7:26 p.m.
mbthomas added a comment.


  The `filefoldmap` (and `dirfoldmap`) are still `@propertycache`d.  They only ever get accessed on systems with case insensitive filesystems, and so will often not be there at all.

REPOSITORY
  rHG Mercurial

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

To: mbthomas, #hg-reviewers, durin42
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):
@@ -1258,6 +1253,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)
 
@@ -1271,6 +1269,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