comparison mercurial/exchange.py @ 23203:3872d563e01a

changelog: handle writepending in the transaction The 'delayupdate' method now takes a transaction object and registers its '_writepending' method for execution in 'transaction.writepending()'. The hook can then use 'transaction.writepending()' directly. At some point this will allow the addition of other file creation during writepending.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 17 Oct 2014 21:55:31 -0700
parents 116b80d63815
children f606e07fa148
comparison
equal deleted inserted replaced
23202:ea5af863fbff 23203:3872d563e01a
852 852
853 def closetransaction(self): 853 def closetransaction(self):
854 """close transaction if created""" 854 """close transaction if created"""
855 if self._tr is not None: 855 if self._tr is not None:
856 repo = self.repo 856 repo = self.repo
857 cl = repo.unfiltered().changelog 857 p = lambda: self._tr.writepending() and repo.root or ""
858 p = cl.writepending() and repo.root or ""
859 p = cl.writepending() and repo.root or ""
860 repo.hook('b2x-pretransactionclose', throw=True, pending=p, 858 repo.hook('b2x-pretransactionclose', throw=True, pending=p,
861 **self._tr.hookargs) 859 **self._tr.hookargs)
862 self._tr.close() 860 self._tr.close()
863 hookargs = dict(self._tr.hookargs) 861 hookargs = dict(self._tr.hookargs)
864 def runhooks(): 862 def runhooks():
1277 tr = repo.transaction('unbundle') 1275 tr = repo.transaction('unbundle')
1278 tr.hookargs['source'] = source 1276 tr.hookargs['source'] = source
1279 tr.hookargs['url'] = url 1277 tr.hookargs['url'] = url
1280 tr.hookargs['bundle2-exp'] = '1' 1278 tr.hookargs['bundle2-exp'] = '1'
1281 r = bundle2.processbundle(repo, cg, lambda: tr).reply 1279 r = bundle2.processbundle(repo, cg, lambda: tr).reply
1282 cl = repo.unfiltered().changelog 1280 p = lambda: tr.writepending() and repo.root or ""
1283 p = cl.writepending() and repo.root or ""
1284 repo.hook('b2x-pretransactionclose', throw=True, pending=p, 1281 repo.hook('b2x-pretransactionclose', throw=True, pending=p,
1285 **tr.hookargs) 1282 **tr.hookargs)
1286 tr.close() 1283 tr.close()
1287 hookargs = dict(tr.hookargs) 1284 hookargs = dict(tr.hookargs)
1288 def runhooks(): 1285 def runhooks():