Beginner, very simple hook question

doahh gavin at prodia.co.uk
Sat Jan 31 05:30:12 CST 2009


Looks like I spoke too soon, it only works for a single file. If I commit
more than one file then only one of them needs the text, the other is
committed even if it does not have the text. I guess I need to get a list of
the files being committed and loop through them. I really haven't been able
to get any information on how to get information from mercurial into hook
shell scripts though.



doahh wrote:
> 
> Well, I got half of it and it was my script that was poor and not me
> misunderstanding mercurial. I needed:
> 
> pretxncommit.file.changed.notice = hg export tip | ( ! grep "This file has
> been modified")
> 
> I am still trying to find out how to check the path of the file is in a
> particular folder though. The only variable I can get seems to be
> $HG_NODE. I am not sure if there are any more or if I can then get the
> file path of the file being committed from $HG_NODE. Any help appreciated.
> 
> 
> 
> doahh wrote:
>> 
>> Hello,
>> 
>> When I do a commit I would like to check that the file being committed
>> contains a particular piece of text if it is in a particular directory
>> (such as web or src). I have been reading:
>> 
>> http://hgbook.red-bean.com/hgbookch10.html
>> http://www.selenic.com/mercurial/wiki/index.cgi/Hook?highlight=(hook)
>> 
>> and the best I have come up with is:
>> 
>> pretxncommit.file.changed.notice = hg export tip | grep "This file has
>> been modified"
>> 
>> However this doesn't work reliably, I think because I am looking at the
>> tip and not the currently being committed file. Every now and again it
>> will let the file through without the text. In SVN I was using svn look
>> to get the information about the file being committed (both it's path so
>> I can check the directory and its contents so I can check for the text),
>> is their an equivalent in mercurial? 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Beginner%2C-very-simple-hook-question-tp21761643p21762391.html
Sent from the Mercurial mailing list archive at Nabble.com.



More information about the Mercurial mailing list