487 def kwcommitctx(self, ctx, error=False): |
487 def kwcommitctx(self, ctx, error=False): |
488 wlock = lock = None |
488 wlock = lock = None |
489 try: |
489 try: |
490 wlock = self.wlock() |
490 wlock = self.wlock() |
491 lock = self.lock() |
491 lock = self.lock() |
492 # store and postpone commit hooks |
|
493 commithooks = {} |
|
494 for name, cmd in ui.configitems('hooks'): |
|
495 if name.split('.', 1)[0] == 'commit': |
|
496 commithooks[name] = cmd |
|
497 ui.setconfig('hooks', name, None) |
|
498 if commithooks: |
|
499 # store parents for commit hooks |
|
500 p1, p2 = ctx.p1(), ctx.p2() |
|
501 xp1, xp2 = p1.hex(), p2 and p2.hex() or '' |
|
502 |
|
503 n = super(kwrepo, self).commitctx(ctx, error) |
492 n = super(kwrepo, self).commitctx(ctx, error) |
504 |
|
505 kwt.overwrite(n, True, None) |
493 kwt.overwrite(n, True, None) |
506 if commithooks: |
|
507 for name, cmd in commithooks.iteritems(): |
|
508 ui.setconfig('hooks', name, cmd) |
|
509 self.hook('commit', node=n, parent1=xp1, parent2=xp2) |
|
510 return n |
494 return n |
511 finally: |
495 finally: |
512 release(lock, wlock) |
496 release(lock, wlock) |
513 |
497 |
514 # monkeypatches |
498 # monkeypatches |