Show More
@@ -1105,10 +1105,7 b' class localrepository(object):' | |||||
1105 | **pycompat.strkwargs(hookargs)) |
|
1105 | **pycompat.strkwargs(hookargs)) | |
1106 | reporef()._afterlock(hook) |
|
1106 | reporef()._afterlock(hook) | |
1107 | tr.addfinalize('txnclose-hook', txnclosehook) |
|
1107 | tr.addfinalize('txnclose-hook', txnclosehook) | |
1108 | def warmscache(tr2): |
|
1108 | tr.addpostclose('warms-cache', self._buildcacheupdater(tr)) | |
1109 | repo = reporef() |
|
|||
1110 | repo.updatecaches(tr2) |
|
|||
1111 | tr.addpostclose('warms-cache', warmscache) |
|
|||
1112 | def txnaborthook(tr2): |
|
1109 | def txnaborthook(tr2): | |
1113 | """To be run if transaction is aborted |
|
1110 | """To be run if transaction is aborted | |
1114 | """ |
|
1111 | """ | |
@@ -1243,6 +1240,20 b' class localrepository(object):' | |||||
1243 | self.destroyed() |
|
1240 | self.destroyed() | |
1244 | return 0 |
|
1241 | return 0 | |
1245 |
|
1242 | |||
|
1243 | def _buildcacheupdater(self, newtransaction): | |||
|
1244 | """called during transaction to build the callback updating cache | |||
|
1245 | ||||
|
1246 | Lives on the repository to help extension who might want to augment | |||
|
1247 | this logic. For this purpose, the created transaction is passed to the | |||
|
1248 | method. | |||
|
1249 | """ | |||
|
1250 | # we must avoid cyclic reference between repo and transaction. | |||
|
1251 | reporef = weakref.ref(self) | |||
|
1252 | def updater(tr): | |||
|
1253 | repo = reporef() | |||
|
1254 | repo.updatecaches(tr) | |||
|
1255 | return updater | |||
|
1256 | ||||
1246 | @unfilteredmethod |
|
1257 | @unfilteredmethod | |
1247 | def updatecaches(self, tr=None): |
|
1258 | def updatecaches(self, tr=None): | |
1248 | """warm appropriate caches |
|
1259 | """warm appropriate caches |
General Comments 0
You need to be logged in to leave comments.
Login now