mercurial/localrepo.py
changeset 26251 5c0f5db65c6b
parent 26250 bc1f8a79b4e4
child 26320 3ac7acb99b04
equal deleted inserted replaced
26250:bc1f8a79b4e4 26251:5c0f5db65c6b
  1019             """To be run if transaction is aborted
  1019             """To be run if transaction is aborted
  1020             """
  1020             """
  1021             reporef().hook('txnabort', throw=False, txnname=desc,
  1021             reporef().hook('txnabort', throw=False, txnname=desc,
  1022                            **tr2.hookargs)
  1022                            **tr2.hookargs)
  1023         tr.addabort('txnabort-hook', txnaborthook)
  1023         tr.addabort('txnabort-hook', txnaborthook)
       
  1024         # avoid eager cache invalidation. in-memory data should be identical
       
  1025         # to stored data if transaction has no error.
       
  1026         tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats)
  1024         self._transref = weakref.ref(tr)
  1027         self._transref = weakref.ref(tr)
  1025         return tr
  1028         return tr
  1026 
  1029 
  1027     def _journalfiles(self):
  1030     def _journalfiles(self):
  1028         return ((self.svfs, 'journal'),
  1031         return ((self.svfs, 'journal'),
  1196         subsequent operation to reread any outside changes.'''
  1199         subsequent operation to reread any outside changes.'''
  1197         # extension should hook this to invalidate its caches
  1200         # extension should hook this to invalidate its caches
  1198         self.invalidate()
  1201         self.invalidate()
  1199         self.invalidatedirstate()
  1202         self.invalidatedirstate()
  1200 
  1203 
  1201     def _refreshfilecachestats(self):
  1204     def _refreshfilecachestats(self, tr):
  1202         """Reload stats of cached files so that they are flagged as valid"""
  1205         """Reload stats of cached files so that they are flagged as valid"""
  1203         for k, ce in self._filecache.items():
  1206         for k, ce in self._filecache.items():
  1204             if k == 'dirstate' or k not in self.__dict__:
  1207             if k == 'dirstate' or k not in self.__dict__:
  1205                 continue
  1208                 continue
  1206             ce.refresh()
  1209             ce.refresh()
  1245         l = self._lockref and self._lockref()
  1248         l = self._lockref and self._lockref()
  1246         if l is not None and l.held:
  1249         if l is not None and l.held:
  1247             l.lock()
  1250             l.lock()
  1248             return l
  1251             return l
  1249 
  1252 
  1250         l = self._lock(self.svfs, "lock", wait, self._refreshfilecachestats,
  1253         l = self._lock(self.svfs, "lock", wait, None,
  1251                        self.invalidate, _('repository %s') % self.origroot)
  1254                        self.invalidate, _('repository %s') % self.origroot)
  1252         self._lockref = weakref.ref(l)
  1255         self._lockref = weakref.ref(l)
  1253         return l
  1256         return l
  1254 
  1257 
  1255     def wlock(self, wait=True):
  1258     def wlock(self, wait=True):