Mercurial > public > mercurial-scm > hg-stable
diff mercurial/exchange.py @ 23222:6b7e60fb0b38
exchange: use the postclose API on transaction
As with changegroup, we should wait for the transaction to be really closed
before scheduling hook execution.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 28 Oct 2014 14:58:36 +0100 |
parents | 61cd79ac4b99 |
children | 6c1351352b6c |
line wrap: on
line diff
--- 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