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

Ulrich Thomas Gabor ulrich.thomas.gabor at googlemail.com
Fri Jul 15 03:42:39 EDT 2016


Hi

I already asked the following question on the users mailing list, but I did not receive an answer, which helps me further. Has someone here an idea, how I can get a list of files in a precommit (or similar) hook, which will be committed (respecting the passed command line arguments)?

See the thread on the other mailing list for some already mentioned ideas:
https://www.mercurial-scm.org/pipermail/mercurial/2016-July/049720.html <https://www.mercurial-scm.org/pipermail/mercurial/2016-July/049720.html>

Best
Ulrich


> Anfang der weitergeleiteten Nachricht:
> 
> Von: Ulrich Thomas Gabor <ulrich.thomas.gabor at googlemail.com>
> Betreff: before commit hook; list files to be committed respecting cmd arguments?
> Datum: 11. Juli 2016 um 19:24:44 MESZ
> An: mercurial at mercurial-scm.org
> 
> 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
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160715/3fa13fbe/attachment.html>


More information about the Mercurial-devel mailing list