Bug 3501 - pretxncommit fails with hg commit --amend
Summary: pretxncommit fails with hg commit --amend
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: earlier
Hardware: Macintosh Mac OS
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-15 11:53 UTC by Jamie Wong
Modified: 2017-11-01 18:05 UTC (History)
4 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jamie Wong 2012-06-15 11:53 UTC
If I have the following in my ~/.hgrc:

[hooks]
pretxncommit.foo = echo "PRETXNCOMMIT $HG_NODE"; hg log -r $HG_NODE

I get the following when running hg commit --amend:

PRETXNCOMMIT ea558bf3b5a3df51dcb6af9c61debcd0f7face3c
abort: 00changelog.i@ea558bf3b5a3: no node!
PRETXNCOMMIT a25a0e6cff13fde4d81bd523c6734f7a6258609a
abort: 00changelog.i@a25a0e6cff13: no node!

The commit then succeeds, but as you can see, I'm not able to retrieve the logs from the commit about to happen.

I also don't understand why there the pretxncommit hook is running twice.
Comment 1 Idan Kamara 2012-06-16 07:10 UTC
It's running twice due to how --amend is implemented. But it shouldn't happen so that's a bug.

I can't seem to reproduce the errors though, can you attach a test script?
Comment 2 Jamie Wong 2012-06-22 17:35 UTC
The abort issue was fixed by upgrading to hg 2.2.2 - the double run of the hook is still happening though.
Comment 3 Matt Mackall 2012-07-29 14:58 UTC
Fixed in 2.2.3 with:

2440822446ce amend: disable hooks when creating intermediate commit