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