Show More
@@ -31,6 +31,13 b' class dirstate(object):' | |||||
31 | elif name == '_copymap': |
|
31 | elif name == '_copymap': | |
32 | self._read() |
|
32 | self._read() | |
33 | return self._copymap |
|
33 | return self._copymap | |
|
34 | elif name == '_foldmap': | |||
|
35 | _foldmap = {} | |||
|
36 | for name in self._map: | |||
|
37 | norm = os.path.normcase(os.path.normpath(name)) | |||
|
38 | _foldmap[norm] = name | |||
|
39 | self._foldmap = _foldmap | |||
|
40 | return self._foldmap | |||
34 | elif name == '_branch': |
|
41 | elif name == '_branch': | |
35 | try: |
|
42 | try: | |
36 | self._branch = (self._opener("branch").read().strip() |
|
43 | self._branch = (self._opener("branch").read().strip() | |
@@ -69,6 +76,12 b' class dirstate(object):' | |||||
69 | elif name == '_folding': |
|
76 | elif name == '_folding': | |
70 | self._folding = not util.checkfolding(self._join('.hg')) |
|
77 | self._folding = not util.checkfolding(self._join('.hg')) | |
71 | return self._folding |
|
78 | return self._folding | |
|
79 | elif name == 'normalize': | |||
|
80 | if self._folding: | |||
|
81 | self.normalize = self._normalize | |||
|
82 | else: | |||
|
83 | self.normalize = lambda x: x | |||
|
84 | return self.normalize | |||
72 | else: |
|
85 | else: | |
73 | raise AttributeError, name |
|
86 | raise AttributeError, name | |
74 |
|
87 | |||
@@ -167,7 +180,7 b' class dirstate(object):' | |||||
167 | dmap[f] = e # we hold onto e[4] because making a subtuple is slow |
|
180 | dmap[f] = e # we hold onto e[4] because making a subtuple is slow | |
168 |
|
181 | |||
169 | def invalidate(self): |
|
182 | def invalidate(self): | |
170 | for a in "_map _copymap _branch _pl _dirs _ignore".split(): |
|
183 | for a in "_map _copymap _foldmap _branch _pl _dirs _ignore".split(): | |
171 | if a in self.__dict__: |
|
184 | if a in self.__dict__: | |
172 | delattr(self, a) |
|
185 | delattr(self, a) | |
173 | self._dirty = False |
|
186 | self._dirty = False | |
@@ -320,6 +333,16 b' class dirstate(object):' | |||||
320 | except KeyError: |
|
333 | except KeyError: | |
321 | self._ui.warn(_("not in dirstate: %s\n") % f) |
|
334 | self._ui.warn(_("not in dirstate: %s\n") % f) | |
322 |
|
335 | |||
|
336 | def _normalize(self, path): | |||
|
337 | normpath = os.path.normcase(os.path.normpath(path)) | |||
|
338 | if normpath in self._foldmap: | |||
|
339 | return self._foldmap[normpath] | |||
|
340 | elif os.path.exists(path): | |||
|
341 | self._foldmap[normpath] = util.fspath(path, self._root) | |||
|
342 | return self._foldmap[normpath] | |||
|
343 | else: | |||
|
344 | return path | |||
|
345 | ||||
323 | def clear(self): |
|
346 | def clear(self): | |
324 | self._map = {} |
|
347 | self._map = {} | |
325 | if "_dirs" in self.__dict__: |
|
348 | if "_dirs" in self.__dict__: | |
@@ -561,7 +584,7 b' class dirstate(object):' | |||||
561 | known[nf] = 1 |
|
584 | known[nf] = 1 | |
562 | if match(nf): |
|
585 | if match(nf): | |
563 | if supported(ff, st.st_mode, verbose=True): |
|
586 | if supported(ff, st.st_mode, verbose=True): | |
564 | yield 'f', nf, st |
|
587 | yield 'f', self.normalize(nf), st | |
565 | elif ff in dc: |
|
588 | elif ff in dc: | |
566 | yield 'm', nf, st |
|
589 | yield 'm', nf, st | |
567 |
|
590 |
General Comments 0
You need to be logged in to leave comments.
Login now