443 # store and postpone commit hooks |
443 # store and postpone commit hooks |
444 commithooks = [] |
444 commithooks = [] |
445 for name, cmd in ui.configitems('hooks'): |
445 for name, cmd in ui.configitems('hooks'): |
446 if name.split('.', 1)[0] == 'commit': |
446 if name.split('.', 1)[0] == 'commit': |
447 commithooks.append((name, cmd)) |
447 commithooks.append((name, cmd)) |
448 ui.setconfig('hooks', name, '') |
448 ui.setconfig('hooks', name, None) |
449 if commithooks: |
449 if commithooks: |
450 # store parents for commit hook environment |
450 # store parents for commit hook environment |
451 if p1 is None: |
451 if p1 is None: |
452 _p1, _p2 = repo.dirstate.parents() |
452 _p1, _p2 = repo.dirstate.parents() |
453 else: |
453 else: |
461 node = super(kwrepo, |
461 node = super(kwrepo, |
462 self).commit(files=files, text=text, user=user, |
462 self).commit(files=files, text=text, user=user, |
463 date=date, match=match, force=force, |
463 date=date, match=match, force=force, |
464 force_editor=force_editor, |
464 force_editor=force_editor, |
465 p1=p1, p2=p2, extra=extra) |
465 p1=p1, p2=p2, extra=extra) |
|
466 |
|
467 # restore commit hooks |
|
468 for name, cmd in commithooks: |
|
469 ui.setconfig('hooks', name, cmd) |
466 if node is not None: |
470 if node is not None: |
467 cl = self.changelog.read(node) |
471 cl = self.changelog.read(node) |
468 mn = self.manifest.read(cl[0]) |
472 mn = self.manifest.read(cl[0]) |
469 candidates = [f for f in cl[3] if mn.has_key(f) |
473 candidates = [f for f in cl[3] if mn.has_key(f) |
470 and _iskwfile(ui, mn, f)] |
474 and _iskwfile(ui, mn, f)] |
471 if candidates: |
475 if candidates: |
472 # 6th, 7th arguments set expansion, commit to True |
476 # 6th, 7th arguments set expansion, commit to True |
473 _overwrite(ui, self, candidates, node, mn, True, True) |
477 _overwrite(ui, self, candidates, node, mn, True, True) |
474 |
478 repo.hook('commit', node=node, parent1=_p1, parent2=_p2) |
475 # restore commit hooks and run them |
|
476 for name, cmd in commithooks: |
|
477 ui.setconfig('hooks', name, cmd) |
|
478 repo.hook('commit', node=node, parent1=_p1, parent2=_p2) |
|
479 return node |
479 return node |
480 finally: |
480 finally: |
481 del wlock, lock |
481 del wlock, lock |
482 |
482 |
483 repo.__class__ = kwrepo |
483 repo.__class__ = kwrepo |