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

Re: Unable to execute perl hooks

From: Andy Levy <andy.levy_at_gmail.com>
Date: Wed, 28 Oct 2009 10:06:25 -0400

On Wed, Oct 28, 2009 at 09:55, roger mills <rogermillsg_at_gmail.com> wrote:
> Hi
>
> I am new to Subversion so bear with me if this is a stupid question.  I am
> writing a subversion hook script in perl.  The script will check the log
> message at commit and get the issue ID (e.g. CNR12345) from the message, if
> the issue ID is not found in the log message it will block the commit else
> move on and execute some sql query to the issue tracking database. svnlook
> fails to get the log message but is successful in getting the author.
> #!D:\perl\bin\perl
> use strict;
> use warnings;
> my ($txn_name, $repo_path) = @ARGV;
> my $svnlook = "D:\\Subversion\\bin\\svnlook.exe";
> my $committer = `$svnlook author $txn_name $repo_path`
>     or die("Unable to get committer with svnlook.\n");

I'm cutting off your script here because it points out the crux of the
problem. You're running on Windows. On Windows, Subversion hooks must
be EXE, BAT or CMD files (the source specifically looks for these
extensions because they don't require an inter. A Perl script will not
execute directly.

The workaround is to create a pre-commit.bat calls the Perl
interpreter & script, and passes the arguments (%1, %2, etc.) into the
Perl script. It'll also have to pass anything returned by your script
back to the user.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2412124

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-10-28 15:07:54 CET

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