Beginner, very simple hook question

Steve Borho steve at borho.org
Sat Jan 31 13:02:58 CST 2009


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


More information about the Mercurial mailing list