1278 # This reduces memory consumption when there are multiple |
1278 # This reduces memory consumption when there are multiple |
1279 # transactions per lock. This can likely go away if issue5045 |
1279 # transactions per lock. This can likely go away if issue5045 |
1280 # fixes the function accumulation. |
1280 # fixes the function accumulation. |
1281 hookargs = tr2.hookargs |
1281 hookargs = tr2.hookargs |
1282 |
1282 |
1283 def hook(): |
1283 def hookfunc(): |
1284 reporef().hook('txnclose', throw=False, txnname=desc, |
1284 repo = reporef() |
1285 **pycompat.strkwargs(hookargs)) |
1285 if hook.hashook(repo.ui, 'txnclose-bookmark'): |
1286 reporef()._afterlock(hook) |
1286 bmchanges = sorted(tr.changes['bookmarks'].items()) |
|
1287 for name, (old, new) in bmchanges: |
|
1288 args = tr.hookargs.copy() |
|
1289 args.update(bookmarks.preparehookargs(name, old, new)) |
|
1290 repo.hook('txnclose-bookmark', throw=False, |
|
1291 txnname=desc, **pycompat.strkwargs(args)) |
|
1292 |
|
1293 repo.hook('txnclose', throw=False, txnname=desc, |
|
1294 **pycompat.strkwargs(hookargs)) |
|
1295 reporef()._afterlock(hookfunc) |
1287 tr.addfinalize('txnclose-hook', txnclosehook) |
1296 tr.addfinalize('txnclose-hook', txnclosehook) |
1288 tr.addpostclose('warms-cache', self._buildcacheupdater(tr)) |
1297 tr.addpostclose('warms-cache', self._buildcacheupdater(tr)) |
1289 def txnaborthook(tr2): |
1298 def txnaborthook(tr2): |
1290 """To be run if transaction is aborted |
1299 """To be run if transaction is aborted |
1291 """ |
1300 """ |