[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: Irfan Sayed <irfu.sayed_at_gmail.com>
Date: Wed, 13 May 2009 18:55:53 +0530

i modified the script
#!/usr/bin/perl

$svnlook = "/usr/bin/svnlook";
$repo = $1;
$txn = $2;
$option = "-t";

my $cmd = "$svnlook changed $option $txn $repo";
if (system($cmd))
{
 print STDERR "svnlook failed\n";
 exit 1;

}

but i am getting this error while commiting

Commit failed (details follow):
Commit blocked by pre-commit hook (exit code 1) with output:
svnlook: missing argument: t
Type 'svnlook help' for usage.
svnlook failed

i have given all the arguments properly but still it is asking some
missing argument t

please advise

irf

On 5/13/09, Irfan Sayed <irfu.sayed_at_gmail.com> wrote:
> sorry. please ignore.
> i did not see your reply
>
> On Wed, May 13, 2009 at 6:00 PM, Irfan Sayed <irfu.sayed_at_gmail.com> wrote:
>
>> please advise
>>
>> regards
>> irf
>>
>> On Wed, May 13, 2009 at 4:39 PM, Irfan Sayed
>> <irfu.sayed_at_gmail.com>wrote:
>>
>>> but i am just passing repository name to perl script. i can not pass
>>> transaction because i dont even know what is the transaction id being
>>> used
>>> at the time of commit.
>>> in pre-commit template $2 refers to the transaction but in perl script i
>>> can not write
>>> $txn = "$ARGV[1]"; beacsue i am not passing any transation id which i
>>> dont
>>> even know.
>>>
>>>
>>> please adise
>>>
>>> regards
>>> irf
>>> On Wed, May 13, 2009 at 4:29 PM, Ryan Schmidt <
>>> subversion-2009b_at_ryandesign.com> wrote:
>>>
>>>> On May 13, 2009, at 04:21, Irfan Sayed 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
>>>>>
>>>>
>>>> The example hook scripts in the template files are written in bash
>>>> syntax, but based on the above you appear to want to write a perl
>>>> script.
>>>> That's fine, but in perl $2 is not how you refer to the second command
>>>> line
>>>> argument; $ARGV[1] is. So the corrected script would be:
>>>>
>>>>
>>>> #!/usr/bin/perl
>>>>
>>>> $svnlook = "/usr/bin/svnlook";
>>>> $repo = "$ARGV[0]";
>>>> $txn = "$ARGV[1]";
>>>> my @cmd = `$svnlook changed -t $txn $repo`;
>>>>
>>>> foreach(@cmd) {
>>>> if ($_ =~/^A/) {
>>>> print STDERR "added\n";
>>>> exit 1;
>>>> } else {
>>>> print STDERR "not added\n";
>>>> exit 1;
>>>> }
>>>> }
>>>>
>>>>
>>>>
>>>>
>>>
>>
>

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

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