Is it possible to add new files to mercurial commit via pretxncommit hook or any other method?

186 views Asked by At

I want to check what files have been modified in current commit and base on that I want to modify or not specified file and add it to that commit.

I was thinking about using script on pretxncommit hook who gives me information that I need but I don't see any possible way to add new modified file to that commit.

Is there any way to do that?

1

There are 1 answers

2
arhak On

it would not be at pretxncommit because at that point the changeset is already built

you'd need to hook earlier, likely on precommit

precommit: Controlling. This is run before starting a commit.

pretxncommit: Controlling. This is run after a new changeset has been created in the local repository, but before the transaction that will make it permanent completes.

https://book.mercurial-scm.org/read/hook.html