diff -r cadc9a723d60 -r 6b7e60fb0b38 mercurial/exchange.py --- a/mercurial/exchange.py Tue Oct 28 15:44:23 2014 +0100 +++ b/mercurial/exchange.py Tue Oct 28 14:58:36 2014 +0100 @@ -857,11 +857,12 @@ p = lambda: self._tr.writepending() and repo.root or "" repo.hook('b2x-pretransactionclose', throw=True, pending=p, **self._tr.hookargs) - self._tr.close() hookargs = dict(self._tr.hookargs) def runhooks(): repo.hook('b2x-transactionclose', **hookargs) - repo._afterlock(runhooks) + self._tr.addpostclose('b2x-hook-transactionclose', + lambda: repo._afterlock(runhooks)) + self._tr.close() def releasetransaction(self): """release transaction if created""" @@ -1281,11 +1282,12 @@ p = lambda: tr.writepending() and repo.root or "" repo.hook('b2x-pretransactionclose', throw=True, pending=p, **tr.hookargs) - tr.close() hookargs = dict(tr.hookargs) def runhooks(): repo.hook('b2x-transactionclose', **hookargs) - repo._afterlock(runhooks) + tr.addpostclose('b2x-hook-transactionclose', + lambda: repo._afterlock(runhooks)) + tr.close() except Exception, exc: exc.duringunbundle2 = True raise