##// END OF EJS Templates
transaction: pass the transaction to 'postclose' callback...
Pierre-Yves David -
r23282:6c135135 default
parent child Browse files
Show More
@@ -816,7 +816,7 b' def addchangegroup(repo, source, srctype'
816 ', '.join([hex(c[:6]) for c in newheads]))
816 ', '.join([hex(c[:6]) for c in newheads]))
817
817
818 tr.addpostclose('changegroup-runhooks-%020i' % clstart,
818 tr.addpostclose('changegroup-runhooks-%020i' % clstart,
819 lambda: repo._afterlock(runhooks))
819 lambda tr: repo._afterlock(runhooks))
820
820
821 tr.close()
821 tr.close()
822
822
@@ -861,7 +861,7 b' class pulloperation(object):'
861 def runhooks():
861 def runhooks():
862 repo.hook('b2x-transactionclose', **hookargs)
862 repo.hook('b2x-transactionclose', **hookargs)
863 self._tr.addpostclose('b2x-hook-transactionclose',
863 self._tr.addpostclose('b2x-hook-transactionclose',
864 lambda: repo._afterlock(runhooks))
864 lambda tr: repo._afterlock(runhooks))
865 self._tr.close()
865 self._tr.close()
866
866
867 def releasetransaction(self):
867 def releasetransaction(self):
@@ -1286,7 +1286,7 b' def unbundle(repo, cg, heads, source, ur'
1286 def runhooks():
1286 def runhooks():
1287 repo.hook('b2x-transactionclose', **hookargs)
1287 repo.hook('b2x-transactionclose', **hookargs)
1288 tr.addpostclose('b2x-hook-transactionclose',
1288 tr.addpostclose('b2x-hook-transactionclose',
1289 lambda: repo._afterlock(runhooks))
1289 lambda tr: repo._afterlock(runhooks))
1290 tr.close()
1290 tr.close()
1291 except Exception, exc:
1291 except Exception, exc:
1292 exc.duringunbundle2 = True
1292 exc.duringunbundle2 = True
@@ -315,6 +315,8 b' class transaction(object):'
315 def addpostclose(self, category, callback):
315 def addpostclose(self, category, callback):
316 """add a callback to be called after the transaction is closed
316 """add a callback to be called after the transaction is closed
317
317
318 The transaction will be given as callback's first argument.
319
318 Category is a unique identifier to allow overwriting an old callback
320 Category is a unique identifier to allow overwriting an old callback
319 with a newer callback.
321 with a newer callback.
320 """
322 """
@@ -350,7 +352,7 b' class transaction(object):'
350 # run post close action
352 # run post close action
351 categories = sorted(self._postclosecallback)
353 categories = sorted(self._postclosecallback)
352 for cat in categories:
354 for cat in categories:
353 self._postclosecallback[cat]()
355 self._postclosecallback[cat](self)
354
356
355 @active
357 @active
356 def abort(self):
358 def abort(self):
General Comments 0
You need to be logged in to leave comments. Login now