comparison mercurial/dirstate.py @ 26887:663eff02a876 stable

dirstate: fix filefoldmap incosistency on file delete The _filefoldmap is not updated in when files are deleted from dirstate. In the case where the file with the same but differently cased name is added afterwards it renders _filefoldmap incorrect. Those steps must occur to for a problem to reproduce: - call status (with listunknown=True), - update working rectory to a commit which does a casefolding change (A -> a) - call status again (it will show the file "a" as deleted) Unfortunately I'm unable to write a test for it because I don't know any core-mercurial command able to reproduce those steps. The bug was originally spotted when hgwatchman was enabled. It caused the changeset contents change during hg rebase (one file unrelarted to changeset was deleted in it after rebase). The hgwatchman is able to hit it because when hgignore changes the hgwatchmans overridestatus is calling original status with listunknown=True.
author Mateusz Kwapich <mitrandir@fb.com>
date Mon, 09 Nov 2015 10:43:23 -0800
parents cbd04ce641b9
children af2663680e95
comparison
equal deleted inserted replaced
26886:29ca5b764f88 26887:663eff02a876
442 return self._copymap 442 return self._copymap
443 443
444 def _droppath(self, f): 444 def _droppath(self, f):
445 if self[f] not in "?r" and "_dirs" in self.__dict__: 445 if self[f] not in "?r" and "_dirs" in self.__dict__:
446 self._dirs.delpath(f) 446 self._dirs.delpath(f)
447
448 if "_filefoldmap" in self.__dict__:
449 normed = util.normcase(f)
450 if normed in self._filefoldmap:
451 del self._filefoldmap[normed]
447 452
448 def _addpath(self, f, state, mode, size, mtime): 453 def _addpath(self, f, state, mode, size, mtime):
449 oldstate = self[f] 454 oldstate = self[f]
450 if state == 'a' or oldstate == 'r': 455 if state == 'a' or oldstate == 'r':
451 scmutil.checkfilename(f) 456 scmutil.checkfilename(f)