comparison mercurial/exchange.py @ 24697:52ff737c63d2

bundle2: drop the experimental hooks The series at e9ede9b4c2f8::8e13cc0825f1 introduced generic transaction level hooking. This makes the experimental bundle2 specific hooks redundant, we drop them.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 09 Apr 2015 16:18:38 -0400
parents e0e28e910fa3
children 88a36edefea5
comparison
equal deleted inserted replaced
24696:553dc2b094d9 24697:52ff737c63d2
849 return self._tr 849 return self._tr
850 850
851 def close(self): 851 def close(self):
852 """close transaction if created""" 852 """close transaction if created"""
853 if self._tr is not None: 853 if self._tr is not None:
854 repo = self.repo
855 p = lambda: self._tr.writepending() and repo.root or ""
856 repo.hook('b2x-pretransactionclose', throw=True, pending=p,
857 **self._tr.hookargs)
858 hookargs = dict(self._tr.hookargs)
859 def runhooks():
860 repo.hook('b2x-transactionclose', **hookargs)
861 self._tr.addpostclose('b2x-hook-transactionclose',
862 lambda tr: repo._afterlock(runhooks))
863 self._tr.close() 854 self._tr.close()
864 855
865 def release(self): 856 def release(self):
866 """release transaction if created""" 857 """release transaction if created"""
867 if self._tr is not None: 858 if self._tr is not None:
1288 tr = repo.transaction('unbundle') 1279 tr = repo.transaction('unbundle')
1289 tr.hookargs['source'] = source 1280 tr.hookargs['source'] = source
1290 tr.hookargs['url'] = url 1281 tr.hookargs['url'] = url
1291 tr.hookargs['bundle2'] = '1' 1282 tr.hookargs['bundle2'] = '1'
1292 r = bundle2.processbundle(repo, cg, lambda: tr).reply 1283 r = bundle2.processbundle(repo, cg, lambda: tr).reply
1293 p = lambda: tr.writepending() and repo.root or ""
1294 repo.hook('b2x-pretransactionclose', throw=True, pending=p,
1295 **tr.hookargs)
1296 hookargs = dict(tr.hookargs)
1297 def runhooks():
1298 repo.hook('b2x-transactionclose', **hookargs)
1299 tr.addpostclose('b2x-hook-transactionclose',
1300 lambda tr: repo._afterlock(runhooks))
1301 tr.close() 1284 tr.close()
1302 except Exception, exc: 1285 except Exception, exc:
1303 exc.duringunbundle2 = True 1286 exc.duringunbundle2 = True
1304 raise 1287 raise
1305 else: 1288 else: