Beginner, very simple hook question

doahh gavin at prodia.co.uk
Sun Feb 1 05:43:25 CST 2009


Thanks for the reply Steve. I am using Debian and so have mercurial 1.01,
running the command you mention gives me an error:

hg status: option -e not recognized

I have however managed to get what I want to do, done. I have used the
output from:

hg log -v -r $HG_NODE

which gives me, among other things, a list of the changed file names which I
parse out in the shell script. I am then using:

hg cat -r tip $filePath

It seems to work OK but if you can see a problem with it then I would be
happy to hear about it.



Steve Borho wrote:
> 
> On Sat, Jan 31, 2009 at 5:30 AM, doahh <gavin at prodia.co.uk> wrote:
>>
>> 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.
> 
> I expect this script will have even more trouble, since 'hg export' is
> giving
> you the diff being committed, the change may be removing your text
> and thus it will show up in the diff, but with a '-' in front of it.
> 
> What your script needs to do is use 'hg status -n -rev -2:-1' to get the
> list
> of files modified by the tip changeset, filter that list by the path you
> want,
> then on each file use: hg cat [FILE] | grep 'my string'
> 
> --
> Steve
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial
> 
> 

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



More information about the Mercurial mailing list