##// END OF EJS Templates
dirstate: remove _dirs property cache...
Durham Goode -
r34678:014bd2a5 default
parent child Browse files
Show More
@@ -519,7 +519,7 b' def perfdirs(ui, repo, **opts):'
519 'a' in dirstate
519 'a' in dirstate
520 def d():
520 def d():
521 dirstate.dirs()
521 dirstate.dirs()
522 del dirstate._dirs
522 del dirstate._map.dirs
523 timer(d)
523 timer(d)
524 fm.end()
524 fm.end()
525
525
@@ -538,8 +538,8 b' def perfdirstatedirs(ui, repo, **opts):'
538 timer, fm = gettimer(ui, opts)
538 timer, fm = gettimer(ui, opts)
539 "a" in repo.dirstate
539 "a" in repo.dirstate
540 def d():
540 def d():
541 "a" in repo.dirstate._dirs
541 "a" in repo.dirstate._map.dirs
542 del repo.dirstate._dirs
542 del repo.dirstate._map.dirs
543 timer(d)
543 timer(d)
544 fm.end()
544 fm.end()
545
545
@@ -562,7 +562,7 b' def perfdirfoldmap(ui, repo, **opts):'
562 def d():
562 def d():
563 dirstate._dirfoldmap.get('a')
563 dirstate._dirfoldmap.get('a')
564 del dirstate._dirfoldmap
564 del dirstate._dirfoldmap
565 del dirstate._dirs
565 del dirstate._map.dirs
566 timer(d)
566 timer(d)
567 fm.end()
567 fm.end()
568
568
@@ -136,7 +136,7 b' class dirstate(object):'
136 def _dirfoldmap(self):
136 def _dirfoldmap(self):
137 f = {}
137 f = {}
138 normcase = util.normcase
138 normcase = util.normcase
139 for name in self._dirs:
139 for name in self._map.dirs:
140 f[normcase(name)] = name
140 f[normcase(name)] = name
141 return f
141 return f
142
142
@@ -166,12 +166,8 b' class dirstate(object):'
166 def _pl(self):
166 def _pl(self):
167 return self._map.parents()
167 return self._map.parents()
168
168
169 @propertycache
170 def _dirs(self):
171 return self._map.dirs()
172
173 def dirs(self):
169 def dirs(self):
174 return self._dirs
170 return self._map.dirs
175
171
176 @rootcache('.hgignore')
172 @rootcache('.hgignore')
177 def _ignore(self):
173 def _ignore(self):
@@ -377,7 +373,7 b' class dirstate(object):'
377 check whether the dirstate has changed before rereading it.'''
373 check whether the dirstate has changed before rereading it.'''
378
374
379 for a in ("_map", "_dirfoldmap", "_branch",
375 for a in ("_map", "_dirfoldmap", "_branch",
380 "_dirs", "_ignore"):
376 "_ignore"):
381 if a in self.__dict__:
377 if a in self.__dict__:
382 delattr(self, a)
378 delattr(self, a)
383 self._lastnormaltime = 0
379 self._lastnormaltime = 0
@@ -405,8 +401,8 b' class dirstate(object):'
405 return self._map.copymap
401 return self._map.copymap
406
402
407 def _droppath(self, f):
403 def _droppath(self, f):
408 if self[f] not in "?r" and "_dirs" in self.__dict__:
404 if self[f] not in "?r" and "dirs" in self._map.__dict__:
409 self._dirs.delpath(f)
405 self._map.dirs.delpath(f)
410
406
411 if "filefoldmap" in self._map.__dict__:
407 if "filefoldmap" in self._map.__dict__:
412 normed = util.normcase(f)
408 normed = util.normcase(f)
@@ -419,18 +415,18 b' class dirstate(object):'
419 oldstate = self[f]
415 oldstate = self[f]
420 if state == 'a' or oldstate == 'r':
416 if state == 'a' or oldstate == 'r':
421 scmutil.checkfilename(f)
417 scmutil.checkfilename(f)
422 if f in self._dirs:
418 if f in self._map.dirs:
423 raise error.Abort(_('directory %r already in dirstate') % f)
419 raise error.Abort(_('directory %r already in dirstate') % f)
424 # shadows
420 # shadows
425 for d in util.finddirs(f):
421 for d in util.finddirs(f):
426 if d in self._dirs:
422 if d in self._map.dirs:
427 break
423 break
428 entry = self._map.get(d)
424 entry = self._map.get(d)
429 if entry is not None and entry[0] != 'r':
425 if entry is not None and entry[0] != 'r':
430 raise error.Abort(
426 raise error.Abort(
431 _('file %r in dirstate clashes with %r') % (d, f))
427 _('file %r in dirstate clashes with %r') % (d, f))
432 if oldstate in "?r" and "_dirs" in self.__dict__:
428 if oldstate in "?r" and "dirs" in self._map.__dict__:
433 self._dirs.addpath(f)
429 self._map.dirs.addpath(f)
434 self._dirty = True
430 self._dirty = True
435 self._updatedfiles.add(f)
431 self._updatedfiles.add(f)
436 self._map[f] = dirstatetuple(state, mode, size, mtime)
432 self._map[f] = dirstatetuple(state, mode, size, mtime)
@@ -607,8 +603,6 b' class dirstate(object):'
607
603
608 def clear(self):
604 def clear(self):
609 self._map = dirstatemap(self._ui, self._opener, self._root)
605 self._map = dirstatemap(self._ui, self._opener, self._root)
610 if "_dirs" in self.__dict__:
611 delattr(self, "_dirs")
612 self._map.setparents(nullid, nullid)
606 self._map.setparents(nullid, nullid)
613 self._lastnormaltime = 0
607 self._lastnormaltime = 0
614 self._updatedfiles.clear()
608 self._updatedfiles.clear()
@@ -1287,6 +1281,7 b' class dirstatemap(object):'
1287 f['.'] = '.' # prevents useless util.fspath() invocation
1281 f['.'] = '.' # prevents useless util.fspath() invocation
1288 return f
1282 return f
1289
1283
1284 @propertycache
1290 def dirs(self):
1285 def dirs(self):
1291 """Returns a set-like object containing all the directories in the
1286 """Returns a set-like object containing all the directories in the
1292 current dirstate.
1287 current dirstate.
General Comments 0
You need to be logged in to leave comments. Login now