comparison mercurial/localrepo.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 eb315418224c
children 2d54aa5397cd
comparison
equal deleted inserted replaced
23202:ea5af863fbff 23203:3872d563e01a
1435 else: 1435 else:
1436 mn = p1.manifestnode() 1436 mn = p1.manifestnode()
1437 files = [] 1437 files = []
1438 1438
1439 # update changelog 1439 # update changelog
1440 self.changelog.delayupdate() 1440 self.changelog.delayupdate(tr)
1441 n = self.changelog.add(mn, files, ctx.description(), 1441 n = self.changelog.add(mn, files, ctx.description(),
1442 trp, p1.node(), p2.node(), 1442 trp, p1.node(), p2.node(),
1443 user, ctx.date(), ctx.extra().copy()) 1443 user, ctx.date(), ctx.extra().copy())
1444 p = lambda: self.changelog.writepending() and self.root or "" 1444 p = lambda: tr.writepending() and self.root or ""
1445 xp1, xp2 = p1.hex(), p2 and p2.hex() or '' 1445 xp1, xp2 = p1.hex(), p2 and p2.hex() or ''
1446 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, 1446 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
1447 parent2=xp2, pending=p) 1447 parent2=xp2, pending=p)
1448 self.changelog.finalize(trp) 1448 self.changelog.finalize(trp)
1449 # set the new commit is proper phase 1449 # set the new commit is proper phase