You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ilan Yaniv <Il...@timetoknow.org> on 2008/12/16 10:12:36 UTC

pre-commit.pl

Hi

I wrote a pre-commit.pl simple script that I want to be executed before
I am commiting a file.

It is simple - 

#!C:\Perl\bin
print STDERR "Hello World\n";

or...
	#!C:\Perl\bin
print "Hello World\n";

But, when I execute the script I am getting no message when I am doing
it from the command line.

Please help.



Ilan Yaniv
Configuration Management
Phone: 03-7534333 ext. 5873
Ilan.Yaniv@timetoknow.org

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: pre-commit.pl

Posted by Andy Levy <an...@gmail.com>.
On Tue, Dec 16, 2008 at 05:12, Ilan Yaniv <Il...@timetoknow.org> wrote:
> Hi
>
> I wrote a pre-commit.pl simple script that I want to be executed before I am
> commiting a file.
>
> It is simple –
>
> #!C:\Perl\bin
>
> print STDERR "Hello World\n";
>
> or…
>
>         #!C:\Perl\bin
>
> print "Hello World\n";
>
> But, when I execute the script I am getting no message when I am doing it
> from the command line.

Since you multi-posted this to the TSVN Users list, is this for a hook
script to run on the server, or as one of TSVN's client-side hook
scripts?

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: pre-commit.pl

Posted by Bogdan Cristea <cr...@gmail.com>.
On Tuesday 16 December 2008 12:12:36 you wrote:
> Hi
>
> I wrote a pre-commit.pl simple script that I want to be executed before
> I am commiting a file.
>
> It is simple -
>
> #!C:\Perl\bin
> print STDERR "Hello World\n";
>
> or...
> 	#!C:\Perl\bin
> print "Hello World\n";
>
> But, when I execute the script I am getting no message when I am doing
> it from the command line.
>
> Please help.
>
>
>
> Ilan Yaniv
> Configuration Management
> Phone: 03-7534333 ext. 5873
> Ilan.Yaniv@timetoknow.org
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=9
>84907
>
> To unsubscribe from this discussion, e-mail:
> [users-unsubscribe@subversion.tigris.org].

I don't have experience with perl or svn hook scripts, but I think that in 
your case is better to create/modify a file, instead of displaying something 
to stdout or stderr.

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: pre-commit.pl

Posted by David Weintraub <qa...@gmail.com>.
Does the pl2bat command work? This converts the Perl script to a batch
script. by placing a few Perl/Batch file lines on the top of the Perl
script.

On Tue, Dec 16, 2008 at 12:43 PM, Andy Levy <an...@gmail.com> wrote:
> On Tue, Dec 16, 2008 at 12:37, David Weintraub <qa...@gmail.com> wrote:
>>> This too will fail, because Perl is not "natively" executable by
>>> Windows. On a Windows SVN server, your hook scripts can only
>>> be BAT or CMD scripts or full-blown executables. A "plain" Perl
>>> script will not execute, it must be called from a BAT or CMD file,
>>> or converted to an EXE.
>>
>> You can change the way Windows handles various file extensions
>> including executing files that have a *.pl extension as Perl files.
>> ActiveState sets this up automatically when you install it.
>>
>> You can also change the PATHEXT system variable which will allow you
>> to execute Perl scripts without the need of adding the *.pl suffix.
>> This will put Perl scripts on the same level as BAT scripts and
>> executable files. I am not sure if ActiveState does this when it is
>> installed.
>
> We tried this a couple years ago, on either this mailing list or dev.
> The Subversion source specifically looks for <hookname>.EXT where EXT
> is CMD, BAT or EXE. It simply does not look for, and therefore cannot
> & will not execute, a pre-commit.pl.
>
> Even with adding .wsh to the mix (I was playing with WSH scripts), it
> didn't work, because the scripts require that one call the interpreter
> with the path to the script as the first argument.
>
>> I suspect that Ilan already had this setup when he sent out the
>> initial email since he didn't complain that his script failed, that it
>> didn't print out the "Hello World" message he expected it to print.
>>
>> On Tue, Dec 16, 2008 at 11:52 AM, Andy Levy <an...@gmail.com> wrote:
>>> On Tue, Dec 16, 2008 at 11:47, David Weintraub <qa...@gmail.com> wrote:
>>>> Is this a server side hook?
>>>>
>>>> Try this:
>>>>
>>>> #! C:/bin/perl
>>>>
>>>> print STDERR "Hello World\n";
>>>> exit 2;
>>>>
>>>> That will display your message back to the client. Of course, it will
>>>> also fail the commit too.
>>>
>>> This too will fail, because Perl is not "natively" executable by
>>> Windows. On a Windows SVN server, your hook scripts can only be BAT or
>>> CMD scripts or full-blown executables. A "plain" Perl script will not
>>> execute, it must be called from a BAT or CMD file, or converted to an
>>> EXE.
>>>
>>>> Server side hooks print nothing to the client unless there's a failure
>>>> and the commit transaction is rejected. Otherwise, it returns nothing.
>>>>
>>>> If you want to send information back to the client, you have to use
>>>> email or even IMing the user. That's the best you're going to do.
>>>>
>>>> On Tue, Dec 16, 2008 at 5:12 AM, Ilan Yaniv <Il...@timetoknow.org> wrote:
>>>>> Hi
>>>>>
>>>>> I wrote a pre-commit.pl simple script that I want to be executed before I am
>>>>> commiting a file.
>>>>>
>>>>> It is simple –
>>>>>
>>>>> #!C:\Perl\bin
>>>>>
>>>>> print STDERR "Hello World\n";
>>>>>
>>>>> or…
>>>>>
>>>>>         #!C:\Perl\bin
>>>>>
>>>>> print "Hello World\n";
>>>>>
>>>>> But, when I execute the script I am getting no message when I am doing it
>>>>> from the command line.
>>>>>
>>>>> Please help.
>>>>>
>>>>> Ilan Yaniv
>>>>>
>>>>> Configuration Management
>>>>>
>>>>> Phone: 03-7534333 ext. 5873
>>>>>
>>>>> Ilan.Yaniv@timetoknow.org
>>>>
>>>>
>>>>
>>>> --
>>>> --
>>>> David Weintraub
>>>> qazwart@gmail.com
>>>>
>>>> ------------------------------------------------------
>>>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=985092
>>>>
>>>> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>>>>
>>>
>>
>>
>>
>> --
>> --
>> David Weintraub
>> qazwart@gmail.com
>>
>



-- 
--
David Weintraub
qazwart@gmail.com

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: pre-commit.pl

Posted by David Weintraub <qa...@gmail.com>.
Does the pl2bat command work? This converts the Perl script to a batch
script. by placing a few Perl/Batch file lines on the top of the Perl
script.

On Tue, Dec 16, 2008 at 12:43 PM, Andy Levy <an...@gmail.com> wrote:
> On Tue, Dec 16, 2008 at 12:37, David Weintraub <qa...@gmail.com> wrote:
>>> This too will fail, because Perl is not "natively" executable by
>>> Windows. On a Windows SVN server, your hook scripts can only
>>> be BAT or CMD scripts or full-blown executables. A "plain" Perl
>>> script will not execute, it must be called from a BAT or CMD file,
>>> or converted to an EXE.
>>
>> You can change the way Windows handles various file extensions
>> including executing files that have a *.pl extension as Perl files.
>> ActiveState sets this up automatically when you install it.
>>
>> You can also change the PATHEXT system variable which will allow you
>> to execute Perl scripts without the need of adding the *.pl suffix.
>> This will put Perl scripts on the same level as BAT scripts and
>> executable files. I am not sure if ActiveState does this when it is
>> installed.
>
> We tried this a couple years ago, on either this mailing list or dev.
> The Subversion source specifically looks for <hookname>.EXT where EXT
> is CMD, BAT or EXE. It simply does not look for, and therefore cannot
> & will not execute, a pre-commit.pl.
>
> Even with adding .wsh to the mix (I was playing with WSH scripts), it
> didn't work, because the scripts require that one call the interpreter
> with the path to the script as the first argument.
>
>> I suspect that Ilan already had this setup when he sent out the
>> initial email since he didn't complain that his script failed, that it
>> didn't print out the "Hello World" message he expected it to print.
>>
>> On Tue, Dec 16, 2008 at 11:52 AM, Andy Levy <an...@gmail.com> wrote:
>>> On Tue, Dec 16, 2008 at 11:47, David Weintraub <qa...@gmail.com> wrote:
>>>> Is this a server side hook?
>>>>
>>>> Try this:
>>>>
>>>> #! C:/bin/perl
>>>>
>>>> print STDERR "Hello World\n";
>>>> exit 2;
>>>>
>>>> That will display your message back to the client. Of course, it will
>>>> also fail the commit too.
>>>
>>> This too will fail, because Perl is not "natively" executable by
>>> Windows. On a Windows SVN server, your hook scripts can only be BAT or
>>> CMD scripts or full-blown executables. A "plain" Perl script will not
>>> execute, it must be called from a BAT or CMD file, or converted to an
>>> EXE.
>>>
>>>> Server side hooks print nothing to the client unless there's a failure
>>>> and the commit transaction is rejected. Otherwise, it returns nothing.
>>>>
>>>> If you want to send information back to the client, you have to use
>>>> email or even IMing the user. That's the best you're going to do.
>>>>
>>>> On Tue, Dec 16, 2008 at 5:12 AM, Ilan Yaniv <Il...@timetoknow.org> wrote:
>>>>> Hi
>>>>>
>>>>> I wrote a pre-commit.pl simple script that I want to be executed before I am
>>>>> commiting a file.
>>>>>
>>>>> It is simple –
>>>>>
>>>>> #!C:\Perl\bin
>>>>>
>>>>> print STDERR "Hello World\n";
>>>>>
>>>>> or…
>>>>>
>>>>>         #!C:\Perl\bin
>>>>>
>>>>> print "Hello World\n";
>>>>>
>>>>> But, when I execute the script I am getting no message when I am doing it
>>>>> from the command line.
>>>>>
>>>>> Please help.
>>>>>
>>>>> Ilan Yaniv
>>>>>
>>>>> Configuration Management
>>>>>
>>>>> Phone: 03-7534333 ext. 5873
>>>>>
>>>>> Ilan.Yaniv@timetoknow.org
>>>>
>>>>
>>>>
>>>> --
>>>> --
>>>> David Weintraub
>>>> qazwart@gmail.com
>>>>
>>>> ------------------------------------------------------
>>>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=985092
>>>>
>>>> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>>>>
>>>
>>
>>
>>
>> --
>> --
>> David Weintraub
>> qazwart@gmail.com
>>
>



-- 
--
David Weintraub
qazwart@gmail.com

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: pre-commit.pl

Posted by Andy Levy <an...@gmail.com>.
On Tue, Dec 16, 2008 at 12:37, David Weintraub <qa...@gmail.com> wrote:
>> This too will fail, because Perl is not "natively" executable by
>> Windows. On a Windows SVN server, your hook scripts can only
>> be BAT or CMD scripts or full-blown executables. A "plain" Perl
>> script will not execute, it must be called from a BAT or CMD file,
>> or converted to an EXE.
>
> You can change the way Windows handles various file extensions
> including executing files that have a *.pl extension as Perl files.
> ActiveState sets this up automatically when you install it.
>
> You can also change the PATHEXT system variable which will allow you
> to execute Perl scripts without the need of adding the *.pl suffix.
> This will put Perl scripts on the same level as BAT scripts and
> executable files. I am not sure if ActiveState does this when it is
> installed.

We tried this a couple years ago, on either this mailing list or dev.
The Subversion source specifically looks for <hookname>.EXT where EXT
is CMD, BAT or EXE. It simply does not look for, and therefore cannot
& will not execute, a pre-commit.pl.

Even with adding .wsh to the mix (I was playing with WSH scripts), it
didn't work, because the scripts require that one call the interpreter
with the path to the script as the first argument.

> I suspect that Ilan already had this setup when he sent out the
> initial email since he didn't complain that his script failed, that it
> didn't print out the "Hello World" message he expected it to print.
>
> On Tue, Dec 16, 2008 at 11:52 AM, Andy Levy <an...@gmail.com> wrote:
>> On Tue, Dec 16, 2008 at 11:47, David Weintraub <qa...@gmail.com> wrote:
>>> Is this a server side hook?
>>>
>>> Try this:
>>>
>>> #! C:/bin/perl
>>>
>>> print STDERR "Hello World\n";
>>> exit 2;
>>>
>>> That will display your message back to the client. Of course, it will
>>> also fail the commit too.
>>
>> This too will fail, because Perl is not "natively" executable by
>> Windows. On a Windows SVN server, your hook scripts can only be BAT or
>> CMD scripts or full-blown executables. A "plain" Perl script will not
>> execute, it must be called from a BAT or CMD file, or converted to an
>> EXE.
>>
>>> Server side hooks print nothing to the client unless there's a failure
>>> and the commit transaction is rejected. Otherwise, it returns nothing.
>>>
>>> If you want to send information back to the client, you have to use
>>> email or even IMing the user. That's the best you're going to do.
>>>
>>> On Tue, Dec 16, 2008 at 5:12 AM, Ilan Yaniv <Il...@timetoknow.org> wrote:
>>>> Hi
>>>>
>>>> I wrote a pre-commit.pl simple script that I want to be executed before I am
>>>> commiting a file.
>>>>
>>>> It is simple –
>>>>
>>>> #!C:\Perl\bin
>>>>
>>>> print STDERR "Hello World\n";
>>>>
>>>> or…
>>>>
>>>>         #!C:\Perl\bin
>>>>
>>>> print "Hello World\n";
>>>>
>>>> But, when I execute the script I am getting no message when I am doing it
>>>> from the command line.
>>>>
>>>> Please help.
>>>>
>>>> Ilan Yaniv
>>>>
>>>> Configuration Management
>>>>
>>>> Phone: 03-7534333 ext. 5873
>>>>
>>>> Ilan.Yaniv@timetoknow.org
>>>
>>>
>>>
>>> --
>>> --
>>> David Weintraub
>>> qazwart@gmail.com
>>>
>>> ------------------------------------------------------
>>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=985092
>>>
>>> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>>>
>>
>
>
>
> --
> --
> David Weintraub
> qazwart@gmail.com
>

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: pre-commit.pl

Posted by David Weintraub <qa...@gmail.com>.
> This too will fail, because Perl is not "natively" executable by
> Windows. On a Windows SVN server, your hook scripts can only
> be BAT or CMD scripts or full-blown executables. A "plain" Perl
> script will not execute, it must be called from a BAT or CMD file,
> or converted to an EXE.

You can change the way Windows handles various file extensions
including executing files that have a *.pl extension as Perl files.
ActiveState sets this up automatically when you install it.

You can also change the PATHEXT system variable which will allow you
to execute Perl scripts without the need of adding the *.pl suffix.
This will put Perl scripts on the same level as BAT scripts and
executable files. I am not sure if ActiveState does this when it is
installed.

I suspect that Ilan already had this setup when he sent out the
initial email since he didn't complain that his script failed, that it
didn't print out the "Hello World" message he expected it to print.

On Tue, Dec 16, 2008 at 11:52 AM, Andy Levy <an...@gmail.com> wrote:
> On Tue, Dec 16, 2008 at 11:47, David Weintraub <qa...@gmail.com> wrote:
>> Is this a server side hook?
>>
>> Try this:
>>
>> #! C:/bin/perl
>>
>> print STDERR "Hello World\n";
>> exit 2;
>>
>> That will display your message back to the client. Of course, it will
>> also fail the commit too.
>
> This too will fail, because Perl is not "natively" executable by
> Windows. On a Windows SVN server, your hook scripts can only be BAT or
> CMD scripts or full-blown executables. A "plain" Perl script will not
> execute, it must be called from a BAT or CMD file, or converted to an
> EXE.
>
>> Server side hooks print nothing to the client unless there's a failure
>> and the commit transaction is rejected. Otherwise, it returns nothing.
>>
>> If you want to send information back to the client, you have to use
>> email or even IMing the user. That's the best you're going to do.
>>
>> On Tue, Dec 16, 2008 at 5:12 AM, Ilan Yaniv <Il...@timetoknow.org> wrote:
>>> Hi
>>>
>>> I wrote a pre-commit.pl simple script that I want to be executed before I am
>>> commiting a file.
>>>
>>> It is simple –
>>>
>>> #!C:\Perl\bin
>>>
>>> print STDERR "Hello World\n";
>>>
>>> or…
>>>
>>>         #!C:\Perl\bin
>>>
>>> print "Hello World\n";
>>>
>>> But, when I execute the script I am getting no message when I am doing it
>>> from the command line.
>>>
>>> Please help.
>>>
>>> Ilan Yaniv
>>>
>>> Configuration Management
>>>
>>> Phone: 03-7534333 ext. 5873
>>>
>>> Ilan.Yaniv@timetoknow.org
>>
>>
>>
>> --
>> --
>> David Weintraub
>> qazwart@gmail.com
>>
>> ------------------------------------------------------
>> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=985092
>>
>> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>>
>



-- 
--
David Weintraub
qazwart@gmail.com

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: pre-commit.pl

Posted by Andy Levy <an...@gmail.com>.
On Tue, Dec 16, 2008 at 11:47, David Weintraub <qa...@gmail.com> wrote:
> Is this a server side hook?
>
> Try this:
>
> #! C:/bin/perl
>
> print STDERR "Hello World\n";
> exit 2;
>
> That will display your message back to the client. Of course, it will
> also fail the commit too.

This too will fail, because Perl is not "natively" executable by
Windows. On a Windows SVN server, your hook scripts can only be BAT or
CMD scripts or full-blown executables. A "plain" Perl script will not
execute, it must be called from a BAT or CMD file, or converted to an
EXE.

> Server side hooks print nothing to the client unless there's a failure
> and the commit transaction is rejected. Otherwise, it returns nothing.
>
> If you want to send information back to the client, you have to use
> email or even IMing the user. That's the best you're going to do.
>
> On Tue, Dec 16, 2008 at 5:12 AM, Ilan Yaniv <Il...@timetoknow.org> wrote:
>> Hi
>>
>> I wrote a pre-commit.pl simple script that I want to be executed before I am
>> commiting a file.
>>
>> It is simple –
>>
>> #!C:\Perl\bin
>>
>> print STDERR "Hello World\n";
>>
>> or…
>>
>>         #!C:\Perl\bin
>>
>> print "Hello World\n";
>>
>> But, when I execute the script I am getting no message when I am doing it
>> from the command line.
>>
>> Please help.
>>
>> Ilan Yaniv
>>
>> Configuration Management
>>
>> Phone: 03-7534333 ext. 5873
>>
>> Ilan.Yaniv@timetoknow.org
>
>
>
> --
> --
> David Weintraub
> qazwart@gmail.com
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=985092
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: pre-commit.pl

Posted by David Weintraub <qa...@gmail.com>.
Is this a server side hook?

Try this:

#! C:/bin/perl

print STDERR "Hello World\n";
exit 2;

That will display your message back to the client. Of course, it will
also fail the commit too.

Server side hooks print nothing to the client unless there's a failure
and the commit transaction is rejected. Otherwise, it returns nothing.

If you want to send information back to the client, you have to use
email or even IMing the user. That's the best you're going to do.

On Tue, Dec 16, 2008 at 5:12 AM, Ilan Yaniv <Il...@timetoknow.org> wrote:
> Hi
>
> I wrote a pre-commit.pl simple script that I want to be executed before I am
> commiting a file.
>
> It is simple –
>
> #!C:\Perl\bin
>
> print STDERR "Hello World\n";
>
> or…
>
>         #!C:\Perl\bin
>
> print "Hello World\n";
>
> But, when I execute the script I am getting no message when I am doing it
> from the command line.
>
> Please help.
>
> Ilan Yaniv
>
> Configuration Management
>
> Phone: 03-7534333 ext. 5873
>
> Ilan.Yaniv@timetoknow.org



-- 
--
David Weintraub
qazwart@gmail.com

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].