2471 p1, p2 = self.dirstate.parents() |
2471 p1, p2 = self.dirstate.parents() |
2472 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') |
2472 hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') |
2473 try: |
2473 try: |
2474 self.hook("precommit", throw=True, parent1=hookp1, |
2474 self.hook("precommit", throw=True, parent1=hookp1, |
2475 parent2=hookp2) |
2475 parent2=hookp2) |
2476 tr = self.transaction('commit') |
2476 with self.transaction('commit'): |
2477 ret = self.commitctx(cctx, True) |
2477 ret = self.commitctx(cctx, True) |
2478 # update bookmarks, dirstate and mergestate |
2478 # update bookmarks, dirstate and mergestate |
2479 bookmarks.update(self, [p1, p2], ret) |
2479 bookmarks.update(self, [p1, p2], ret) |
2480 cctx.markcommitted(ret) |
2480 cctx.markcommitted(ret) |
2481 ms.reset() |
2481 ms.reset() |
2482 tr.close() |
|
2483 except: # re-raises |
2482 except: # re-raises |
2484 if edited: |
2483 if edited: |
2485 self.ui.write( |
2484 self.ui.write( |
2486 _('note: commit message saved in %s\n') % msgfn) |
2485 _('note: commit message saved in %s\n') % msgfn) |
2487 raise |
2486 raise |
2488 |
2487 |
2489 finally: |
2488 finally: |
2490 lockmod.release(tr, lock, wlock) |
2489 lockmod.release(lock, wlock) |
2491 |
2490 |
2492 def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2): |
2491 def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2): |
2493 # hack for command that use a temporary commit (eg: histedit) |
2492 # hack for command that use a temporary commit (eg: histedit) |
2494 # temporary commit got stripped before hook release |
2493 # temporary commit got stripped before hook release |
2495 if self.changelog.hasnode(ret): |
2494 if self.changelog.hasnode(ret): |