##// END OF EJS Templates
dirstate: split the foldmap into separate ones for files and directories...
Siddharth Agarwal -
r24540:25c1d3ca default
parent child Browse files
Show More
@@ -87,15 +87,21 b' class dirstate(object):'
87 87 return self._copymap
88 88
89 89 @propertycache
90 def _foldmap(self):
90 def _filefoldmap(self):
91 91 f = {}
92 92 normcase = util.normcase
93 93 for name, s in self._map.iteritems():
94 94 if s[0] != 'r':
95 95 f[normcase(name)] = name
96 f['.'] = '.' # prevents useless util.fspath() invocation
97 return f
98
99 @propertycache
100 def _dirfoldmap(self):
101 f = {}
102 normcase = util.normcase
96 103 for name in self._dirs:
97 104 f[normcase(name)] = name
98 f['.'] = '.' # prevents useless util.fspath() invocation
99 105 return f
100 106
101 107 @repocache('branch')
@@ -332,8 +338,8 b' class dirstate(object):'
332 338 self._pl = p
333 339
334 340 def invalidate(self):
335 for a in ("_map", "_copymap", "_foldmap", "_branch", "_pl", "_dirs",
336 "_ignore"):
341 for a in ("_map", "_copymap", "_filefoldmap", "_dirfoldmap", "_branch",
342 "_pl", "_dirs", "_ignore"):
337 343 if a in self.__dict__:
338 344 delattr(self, a)
339 345 self._lastnormaltime = 0
@@ -492,24 +498,27 b' class dirstate(object):'
492 498
493 499 def _normalizefile(self, path, isknown, ignoremissing=False, exists=None):
494 500 normed = util.normcase(path)
495 folded = self._foldmap.get(normed, None)
501 folded = self._filefoldmap.get(normed, None)
496 502 if folded is None:
497 503 if isknown:
498 504 folded = path
499 505 else:
500 506 folded = self._discoverpath(path, normed, ignoremissing, exists,
501 self._foldmap)
507 self._filefoldmap)
502 508 return folded
503 509
504 510 def _normalize(self, path, isknown, ignoremissing=False, exists=None):
505 511 normed = util.normcase(path)
506 folded = self._foldmap.get(normed, None)
512 folded = self._filefoldmap.get(normed,
513 self._dirfoldmap.get(normed, None))
507 514 if folded is None:
508 515 if isknown:
509 516 folded = path
510 517 else:
518 # store discovered result in dirfoldmap so that future
519 # normalizefile calls don't start matching directories
511 520 folded = self._discoverpath(path, normed, ignoremissing, exists,
512 self._foldmap)
521 self._dirfoldmap)
513 522 return folded
514 523
515 524 def normalize(self, path, isknown=False, ignoremissing=False):
General Comments 0
You need to be logged in to leave comments. Login now