diff -r c1aede895072 -r f10019d2ee0a mercurial/exchange.py --- 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