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.
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?
The abort issue was fixed by upgrading to hg 2.2.2 - the double run of the hook is still happening though.
Fixed in 2.2.3 with: 2440822446ce amend: disable hooks when creating intermediate commit