comparison mercurial/localrepo.py @ 17324:9f94358f9f93 stable

localrepo: clear the filecache on _rollback() and destroyed() This restores the old behaviour of clearing the filecache when the repo is destroyed but combines it with also clearing it on _rollback. Before, we tried to only call it through _rollback but that ruined callers of destroyed. Doing it on both code paths covers destroyed being called from somewhere else, e.g. strip.
author Idan Kamara <idankk86@gmail.com>
date Sat, 28 Jul 2012 22:40:30 +0300
parents 7d2967de2c04
children 935831597e16
comparison
equal deleted inserted replaced
17323:2be2a070f294 17324:9f94358f9f93
998 if os.path.exists(self.sjoin('undo.phaseroots')): 998 if os.path.exists(self.sjoin('undo.phaseroots')):
999 util.rename(self.sjoin('undo.phaseroots'), 999 util.rename(self.sjoin('undo.phaseroots'),
1000 self.sjoin('phaseroots')) 1000 self.sjoin('phaseroots'))
1001 self.invalidate() 1001 self.invalidate()
1002 1002
1003 # Discard all cache entries to force reloading everything.
1004 self._filecache.clear()
1005
1003 parentgone = (parents[0] not in self.changelog.nodemap or 1006 parentgone = (parents[0] not in self.changelog.nodemap or
1004 parents[1] not in self.changelog.nodemap) 1007 parents[1] not in self.changelog.nodemap)
1005 if parentgone: 1008 if parentgone:
1006 util.rename(self.join('undo.dirstate'), self.join('dirstate')) 1009 util.rename(self.join('undo.dirstate'), self.join('dirstate'))
1007 try: 1010 try:
1064 try: 1067 try:
1065 delattr(self, k) 1068 delattr(self, k)
1066 except AttributeError: 1069 except AttributeError:
1067 pass 1070 pass
1068 self.invalidatecaches() 1071 self.invalidatecaches()
1069
1070 # Discard all cache entries to force reloading everything.
1071 self._filecache.clear()
1072 1072
1073 def _lock(self, lockname, wait, releasefn, acquirefn, desc): 1073 def _lock(self, lockname, wait, releasefn, acquirefn, desc):
1074 try: 1074 try:
1075 l = lock.lock(lockname, 0, releasefn, desc=desc) 1075 l = lock.lock(lockname, 0, releasefn, desc=desc)
1076 except error.LockHeld, inst: 1076 except error.LockHeld, inst:
1500 # XXX this is suboptimal when qrefresh'ing: we strip the current 1500 # XXX this is suboptimal when qrefresh'ing: we strip the current
1501 # head, refresh the tag cache, then immediately add a new head. 1501 # head, refresh the tag cache, then immediately add a new head.
1502 # But I think doing it this way is necessary for the "instant 1502 # But I think doing it this way is necessary for the "instant
1503 # tag cache retrieval" case to work. 1503 # tag cache retrieval" case to work.
1504 self.invalidatecaches() 1504 self.invalidatecaches()
1505
1506 # Discard all cache entries to force reloading everything.
1507 self._filecache.clear()
1505 1508
1506 def walk(self, match, node=None): 1509 def walk(self, match, node=None):
1507 ''' 1510 '''
1508 walk recursively through the directory tree or a given 1511 walk recursively through the directory tree or a given
1509 changeset, finding all files matched by the match 1512 changeset, finding all files matched by the match