[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: pre-commit hooks does not show any output

From: Hari Kodungallur <hkodungallur_at_gmail.com>
Date: Thu, 15 May 2008 14:02:40 -0700

On Thu, May 15, 2008 at 12:38 PM, Daevid Vincent <daevid_at_daevid.com> wrote:

> Yeah, I struggled last night for several hours trying to find what would
> seem to be a pretty standard pre-commit script. I would have expected the
> examples would be more verbose and have some "uncomment this line, make sure
> this path is correct, and you're golden" type of stuff in there. Mine had a
> reference to "commit-access-control.pl "$REPOS" "$TXN"
> commit-access-control.cfg || exit 1" Ö I don't even have a file named
> "commit-access-control.pl" on my entire file system !?!

commit-access-control.pl is part of the source distribution.
Note that this is provided in a file that is only a template. If it did
mention this fact (that the perl script is part of the source distribution),
it would be helpful. May be you should send a request to the dev. However,
I don't think it is a huge deal. Lot of people of already figured it out :-)

> Anyways Hari, Hopefully this will save you some gray hair pulling.
> The first trick that nobody mentions is that you have to redirect all
> output to stderr (?!) so you have to do this kind of redirection annoyance:
> echo "A commit log message is required." *1>&2*

The documentation for pre-commit says that: "Anything printed to stderr is
marshalled back to the client" in case of non-zero exit state.
This (1>&2) is a common way to redirect output stderr in bash.

[Basically, I don't understand the "(?!)" and why it is an annoyance, if the
documentation asks you to print things to stderr]

> The next thing that took me forever to figure out (and find examples on
> the net) is that you have to do this completely convoluted "SVNLOOK" thing
> to get the filenames you are trying to check. GRRRÖ

You are correct that we need to use SVNLOOK to get the check-in details.
However, (again) I am not quite sure why it is convoluted. This is an
extremely simple to use set of commands.

> Another huge issue I found is that almost all the examples are in Python!
> I would have liked to find a PHP one ideally, or again, at least have the
> default .tmpl ones (in Bash) be more explicit.

There are a couple of examples in bash. Other examples in the svn repository
mentioned in the template script are python. There are actually a few server
side scripts in perl and ruby as well that is part of the source
distribution (commit-access-control file is one of them). They all are
designed to be called from hooks.

But I believe the idea is to provide the user with information on how you
can use the hooks to accomplish different things. Once you have the info,
you are free to use any language you wish. [Unless some sort of 'web' is
involved, I have not too many instances of php being used purely for
scripting; but I could be wrong.].

> Long story short, here is what I came up with so far in the five plus hours
> I spent last night on it
> (I will keep it updated as I learn more and find more interesting/useful
> parts to add to the script):**
> *http://www.daevid.com/content/examples/snippets.php*

I think the information you provide are very useful. It is great that you
have published it in your website.

Received on 2008-05-15 23:03:10 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.