before commit hook; list files to be committed respecting cmd arguments?

Ulrich Thomas Gabor ulrich.thomas.gabor at googlemail.com
Mon Jul 11 17:24:44 UTC 2016


Hi

I'd like to write an in-process Python hook that runs a check on the files that will be committed and based on that information has the possibility to abort the commit process.

My first attempt was to use a precommit hook, which can abort a commit, but I did not find a possibility to get a list of all the files, which will be committed. There is repo[None].files(), which lists all the files that have changed, but it does not respect command line arguments. When someone appends file arguments to the hg call (e.g. hg commit -m "lorem" only_this_file.txt) I found no possibility to respect this "filter". The files method always returns all files.

Is there a way to get a list of only those files, which have changed and will actually be processed by mercurial respecting the passed command line arguments?

Best
Ulrich



More information about the Mercurial mailing list