mercurial/localrepo.py
changeset 26251 5c0f5db65c6b
parent 26250 bc1f8a79b4e4
child 26320 3ac7acb99b04
--- a/mercurial/localrepo.py	Tue Sep 15 21:00:28 2015 +0900
+++ b/mercurial/localrepo.py	Tue Sep 15 00:32:39 2015 +0900
@@ -1021,6 +1021,9 @@
             reporef().hook('txnabort', throw=False, txnname=desc,
                            **tr2.hookargs)
         tr.addabort('txnabort-hook', txnaborthook)
+        # avoid eager cache invalidation. in-memory data should be identical
+        # to stored data if transaction has no error.
+        tr.addpostclose('refresh-filecachestats', self._refreshfilecachestats)
         self._transref = weakref.ref(tr)
         return tr
 
@@ -1198,7 +1201,7 @@
         self.invalidate()
         self.invalidatedirstate()
 
-    def _refreshfilecachestats(self):
+    def _refreshfilecachestats(self, tr):
         """Reload stats of cached files so that they are flagged as valid"""
         for k, ce in self._filecache.items():
             if k == 'dirstate' or k not in self.__dict__:
@@ -1247,7 +1250,7 @@
             l.lock()
             return l
 
-        l = self._lock(self.svfs, "lock", wait, self._refreshfilecachestats,
+        l = self._lock(self.svfs, "lock", wait, None,
                        self.invalidate, _('repository %s') % self.origroot)
         self._lockref = weakref.ref(l)
         return l