diff mercurial/exchange.py @ 23047:f10019d2ee0a

hook: schedule run "b2x-transactionclose" for after lock release Hooks that run after the transaction need to be able to touch the repository. So we need to run them after the lock release. This is similar to what the "changegroup" hook is doing in the `addchangegroup` function.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 17 Oct 2014 02:17:36 -0700
parents e4aeb14248ca
children e62c330a044f
line wrap: on
line diff
--- a/mercurial/exchange.py	Fri Oct 17 15:25:32 2014 -0700
+++ b/mercurial/exchange.py	Fri Oct 17 02:17:36 2014 -0700
@@ -841,7 +841,10 @@
             repo.hook('b2x-pretransactionclose', throw=True, pending=p,
                       **self._tr.hookargs)
             self._tr.close()
-            repo.hook('b2x-transactionclose', **self._tr.hookargs)
+            hookargs = dict(self._tr.hookargs)
+            def runhooks():
+                repo.hook('b2x-transactionclose', **hookargs)
+            repo._afterlock(runhooks)
 
     def releasetransaction(self):
         """release transaction if created"""
@@ -1247,7 +1250,10 @@
                 repo.hook('b2x-pretransactionclose', throw=True, pending=p,
                           **tr.hookargs)
                 tr.close()
-                repo.hook('b2x-transactionclose', **tr.hookargs)
+                hookargs = dict(tr.hookargs)
+                def runhooks():
+                    repo.hook('b2x-transactionclose', **hookargs)
+                repo._afterlock(runhooks)
             except Exception, exc:
                 exc.duringunbundle2 = True
                 raise