129 def _map(self): |
129 def _map(self): |
130 '''Return the dirstate contents as a map from filename to |
130 '''Return the dirstate contents as a map from filename to |
131 (state, mode, size, time).''' |
131 (state, mode, size, time).''' |
132 self._read() |
132 self._read() |
133 return self._map |
133 return self._map |
134 |
|
135 @propertycache |
|
136 def _dirfoldmap(self): |
|
137 f = {} |
|
138 normcase = util.normcase |
|
139 for name in self._map.dirs: |
|
140 f[normcase(name)] = name |
|
141 return f |
|
142 |
134 |
143 @property |
135 @property |
144 def _sparsematcher(self): |
136 def _sparsematcher(self): |
145 """The matcher for the sparse checkout. |
137 """The matcher for the sparse checkout. |
146 |
138 |
370 |
362 |
371 This is different from localrepo.invalidatedirstate() because it always |
363 This is different from localrepo.invalidatedirstate() because it always |
372 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to |
364 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to |
373 check whether the dirstate has changed before rereading it.''' |
365 check whether the dirstate has changed before rereading it.''' |
374 |
366 |
375 for a in ("_map", "_dirfoldmap", "_branch", |
367 for a in ("_map", "_branch", "_ignore"): |
376 "_ignore"): |
|
377 if a in self.__dict__: |
368 if a in self.__dict__: |
378 delattr(self, a) |
369 delattr(self, a) |
379 self._lastnormaltime = 0 |
370 self._lastnormaltime = 0 |
380 self._dirty = False |
371 self._dirty = False |
381 self._updatedfiles.clear() |
372 self._updatedfiles.clear() |
566 |
557 |
567 def _normalize(self, path, isknown, ignoremissing=False, exists=None): |
558 def _normalize(self, path, isknown, ignoremissing=False, exists=None): |
568 normed = util.normcase(path) |
559 normed = util.normcase(path) |
569 folded = self._map.filefoldmap.get(normed, None) |
560 folded = self._map.filefoldmap.get(normed, None) |
570 if folded is None: |
561 if folded is None: |
571 folded = self._dirfoldmap.get(normed, None) |
562 folded = self._map.dirfoldmap.get(normed, None) |
572 if folded is None: |
563 if folded is None: |
573 if isknown: |
564 if isknown: |
574 folded = path |
565 folded = path |
575 else: |
566 else: |
576 # store discovered result in dirfoldmap so that future |
567 # store discovered result in dirfoldmap so that future |
577 # normalizefile calls don't start matching directories |
568 # normalizefile calls don't start matching directories |
578 folded = self._discoverpath(path, normed, ignoremissing, exists, |
569 folded = self._discoverpath(path, normed, ignoremissing, exists, |
579 self._dirfoldmap) |
570 self._map.dirfoldmap) |
580 return folded |
571 return folded |
581 |
572 |
582 def normalize(self, path, isknown=False, ignoremissing=False): |
573 def normalize(self, path, isknown=False, ignoremissing=False): |
583 ''' |
574 ''' |
584 normalize the case of a pathname when on a casefolding filesystem |
575 normalize the case of a pathname when on a casefolding filesystem |
873 |
864 |
874 for norm, paths in normed.iteritems(): |
865 for norm, paths in normed.iteritems(): |
875 if len(paths) > 1: |
866 if len(paths) > 1: |
876 for path in paths: |
867 for path in paths: |
877 folded = self._discoverpath(path, norm, True, None, |
868 folded = self._discoverpath(path, norm, True, None, |
878 self._dirfoldmap) |
869 self._map.dirfoldmap) |
879 if path != folded: |
870 if path != folded: |
880 results[path] = None |
871 results[path] = None |
881 |
872 |
882 return results, dirsfound, dirsnotfound |
873 return results, dirsfound, dirsnotfound |
883 |
874 |