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

Re: pre commit trigger

From: Andy Levy <andy.levy_at_gmail.com>
Date: Wed, 13 May 2009 06:31:14 -0400

On Wed, May 13, 2009 at 05:21, Irfan Sayed <irfu.sayed_at_gmail.com> wrote:
> i tried both the things but still not working. please help
> here is my small script
>
> $svnlook = "/usr/bin/svnlook";
> $repo = "/usr/local/svn/projects";
> my @cmd = `$svnlook changed -t $2 $repo`;
> foreach(@cmd)
> {
>  if ($_ =~/^A/)
> {
>  print STDERR "added\n";
>  exit 1;
> }
> else{
>  print STDERR "not added\n";
>  exit 1;
> }
> }
>
> this is just the sample simple script which i want to execute before commit.
> it is not giving any output when i add or midify any file
>
> Please advise

Why are you not using the repository path passed into the hook script
by Subversion itself?

Have you looked at the output of svnlook changed to make sure your
regular expression is correct?

> On Tue, May 12, 2009 at 7:46 PM, Ryan Schmidt
> <subversion-2009b_at_ryandesign.com> wrote:
>>
>> On May 12, 2009, at 09:03, Irfan Sayed wrote:
>>
>>> here is the command i am using...
>>>
>>> svnlook changed -t $2 $repo
>>> where $2 is the transaction no as given by pre-commit hook and $repo
>>> contains the name of the repository.
>>> isuue is that command is executing but all the print statement which i
>>> mentioned in perl script i am not able to see
>>> i am using tortise SVN client
>>
>> You will only see the output of your print statements on the client if you
>> do 2 things:
>>
>> 1. Print to stderr instead of stdout.
>> 2. Exit from the pre-commit hook script with a status other than 0. Yes,
>> this will cause your pre-commit hook to fail. You cannot show output to the
>> client unless your script fails.
>>
>> Are you doing both of those things?
>>
>> For example, in bash, you could do this:
>>
>>
>> #!/bin/bash
>>
>> echo "This message will be seen by the client" 1>&2
>> exit 1
>>
>>
>>
>
>

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-05-13 12:32:17 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.