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 11:47:22 UTC

perl hooks

So here is the thing.

I have a perl script. It is running OK from command line
But when I execute the script from hook (I run in command line svn
commit...) nothing happens.

Why ?????

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

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

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

Re: perl hooks

Posted by Marc Haisenko <ha...@comdasys.com>.
On Tuesday 16 December 2008 14:34:46 Ilan Yaniv wrote:
> When I changed that the script will become exe (perl2exe) all worked
> out.
> Now I added perl GUI. I want a messagebox to be poped out.
>
> When I run the hook, the script get stuck, no messagebox shown no OK
> button to continue.
>
> Ilan Yaniv

This can't work because the hook is run on the server which is normally on a 
different computer or at least a different user. The only thing you can do is 
to output error messages on STDERR. Note that this is only working for pre-* 
scripts.
	Marc

-- 
Marc Haisenko

Comdasys AG
Rüdesheimer Str. 7
80686 München
Germany

Tel.: +49 (0)89 548 433 321

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

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


RE: perl hooks

Posted by Ilan Yaniv <Il...@timetoknow.org>.
When I changed that the script will become exe (perl2exe) all worked
out.
Now I added perl GUI. I want a messagebox to be poped out.

When I run the hook, the script get stuck, no messagebox shown no OK
button to continue.

Ilan Yaniv

-----Original Message-----
From: Erik Hemdal [mailto:erik@comprehensivepower.com] 
Sent: Tuesday, December 16, 2008 3:32 PM
To: Ilan Yaniv
Cc: users@subversion.tigris.org
Subject: Re: perl hooks

Quoting Ilan Yaniv <Il...@timetoknow.org>:

> So here is the thing.
>
> I have a perl script. It is running OK from command line
> But when I execute the script from hook (I run in command line svn
> commit...) nothing happens.
>
> Why ?????

Hook scripts run without your normal PATH setup, so commands in your
script
can't be found unless you give a complete path to the command.  The SVN
book
has a nice description of how it all works and why it's this way.

Erik

>
> Ilan Yaniv
> Configuration Management
> Phone: 03-7534333 ext. 5873
> Ilan.Yaniv@timetoknow.org
>
> ------------------------------------------------------
>
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageI
d=984934
>
> To unsubscribe from this discussion, e-mail:
> [users-unsubscribe@subversion.tigris.org].

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

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

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

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


RE: perl hooks

Posted by Ilan Yaniv <Il...@timetoknow.org>.
When I changed that the script will become exe (perl2exe) all worked
out.
Now I added perl GUI. I want a messagebox to be poped out.

When I run the hook, the script get stuck, no messagebox shown no OK
button to continue.

Ilan Yaniv

-----Original Message-----
From: Erik Hemdal [mailto:erik@comprehensivepower.com] 
Sent: Tuesday, December 16, 2008 3:32 PM
To: Ilan Yaniv
Cc: users@subversion.tigris.org
Subject: Re: perl hooks

Quoting Ilan Yaniv <Il...@timetoknow.org>:

> So here is the thing.
>
> I have a perl script. It is running OK from command line
> But when I execute the script from hook (I run in command line svn
> commit...) nothing happens.
>
> Why ?????

Hook scripts run without your normal PATH setup, so commands in your
script
can't be found unless you give a complete path to the command.  The SVN
book
has a nice description of how it all works and why it's this way.

Erik

>
> Ilan Yaniv
> Configuration Management
> Phone: 03-7534333 ext. 5873
> Ilan.Yaniv@timetoknow.org
>
> ------------------------------------------------------
>
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageI
d=984934
>
> To unsubscribe from this discussion, e-mail:
> [users-unsubscribe@subversion.tigris.org].

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

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


Re: perl hooks

Posted by Erik Hemdal <er...@comprehensivepower.com>.
Quoting Ilan Yaniv <Il...@timetoknow.org>:

> So here is the thing.
>
> I have a perl script. It is running OK from command line
> But when I execute the script from hook (I run in command line svn
> commit...) nothing happens.
>
> Why ?????

Hook scripts run without your normal PATH setup, so commands in your script
can't be found unless you give a complete path to the command.  The SVN book
has a nice description of how it all works and why it's this way.

Erik

>
> Ilan Yaniv
> Configuration Management
> Phone: 03-7534333 ext. 5873
> Ilan.Yaniv@timetoknow.org
>
> ------------------------------------------------------
>
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=984934
>
> To unsubscribe from this discussion, e-mail:
> [users-unsubscribe@subversion.tigris.org].

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

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

Re: perl hooks

Posted by Erik Hemdal <er...@comprehensivepower.com>.
Quoting Ilan Yaniv <Il...@timetoknow.org>:

> So here is the thing.
>
> I have a perl script. It is running OK from command line
> But when I execute the script from hook (I run in command line svn
> commit...) nothing happens.
>
> Why ?????

Hook scripts run without your normal PATH setup, so commands in your script
can't be found unless you give a complete path to the command.  The SVN book
has a nice description of how it all works and why it's this way.

Erik

>
> Ilan Yaniv
> Configuration Management
> Phone: 03-7534333 ext. 5873
> Ilan.Yaniv@timetoknow.org
>
> ------------------------------------------------------
>
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=984934
>
> To unsubscribe from this discussion, e-mail:
> [users-unsubscribe@subversion.tigris.org].

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

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

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

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

RE: perl hooks

Posted by Ilan Yaniv <Il...@timetoknow.org>.
BTW, if I convert the perl to exe and executes - it works.

I have a windows server.

 

________________________________

From: Ilan Yaniv [mailto:Ilan.Yaniv@timetoknow.org] 
Sent: Tuesday, December 16, 2008 1:47 PM
To: users@subversion.tigris.org
Subject: perl hooks

 

So here is the thing.

I have a perl script. It is running OK from command line

But when I execute the script from hook (I run in command line svn
commit...) nothing happens.

Why ?????

Ilan Yaniv

Configuration Management

Phone: 03-7534333 ext. 5873

Ilan.Yaniv@timetoknow.org <ma...@timetoknow.org>

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

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

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

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

RE: perl hooks

Posted by Ilan Yaniv <Il...@timetoknow.org>.
BTW, if I convert the perl to exe and executes - it works.

I have a windows server.

 

________________________________

From: Ilan Yaniv [mailto:Ilan.Yaniv@timetoknow.org] 
Sent: Tuesday, December 16, 2008 1:47 PM
To: users@subversion.tigris.org
Subject: perl hooks

 

So here is the thing.

I have a perl script. It is running OK from command line

But when I execute the script from hook (I run in command line svn
commit...) nothing happens.

Why ?????

Ilan Yaniv

Configuration Management

Phone: 03-7534333 ext. 5873

Ilan.Yaniv@timetoknow.org <ma...@timetoknow.org>

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

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

Re: perl hooks

Posted by Simon Lucy <si...@objective2k.com>.
Ilan Yaniv wrote:
> Fine, the reason to all those messages is that I got no answer for the
> whole day long, and this is the reason I opened so many questions, sorry
> for the trouble.
>
> Next,
> I changed the Perl script to be .exe file. YEEPEE it works.
> Now I want a message to be sent to the committer. Most of the people
> here use Tortoise, but even with command line, I want a message to be
> outputted not only to a log file but also to the standard output and the
> Tortoise window.
>   
You really want a client side hook then and there are security issues 
with those.  If your users have Tortoise then you can have client side 
hooks in that which could open a dialog box but it wouldn't work for the 
command line.

S

> What I was trying to do is to use Perl\Tk which is the Perl GUI library,
> and to show the user a message box with the warning. This only got my
> client to get stuck and the commit to fail, and many other problems,
> because there was no message window to the user.
>
> How do I send messages as output of the hook?
>
> Ilan Yaniv
>
> -----Original Message-----
> From: Andy Levy [mailto:andy.levy@gmail.com] 
> Sent: Tuesday, December 16, 2008 4:15 PM
> To: Ilan Yaniv
> Cc: users@subversion.tigris.org
> Subject: Re: perl hooks
>
> On Tue, Dec 16, 2008 at 06:47, Ilan Yaniv <Il...@timetoknow.org>
> wrote:
>   
>> So here is the thing.
>>
>> I have a perl script. It is running OK from command line
>>
>> But when I execute the script from hook (I run in command line svn
>> commit...) nothing happens.
>>
>> Why ?????
>>     
>
> Because on a Windows server, your pre-commit script must be
> pre-commit.bat, pre-commit.exe or pre-commit.cmd. IOW, it must be an
> executable, or a Windows batch file/CMD script which then calls your
> Perl script.
>
> BTW, you seem to have posted a large number of messages on this one
> topic today. Please consider carefully before posting, and post your
> complete message all at once. If you must "continue" a topic, please
> reply to your original post, such that it all appears in one
> discussion thread.
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=985019
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>

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

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

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

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

Re: perl hooks

Posted by Simon Lucy <si...@objective2k.com>.
Ilan Yaniv wrote:
> Fine, the reason to all those messages is that I got no answer for the
> whole day long, and this is the reason I opened so many questions, sorry
> for the trouble.
>
> Next,
> I changed the Perl script to be .exe file. YEEPEE it works.
> Now I want a message to be sent to the committer. Most of the people
> here use Tortoise, but even with command line, I want a message to be
> outputted not only to a log file but also to the standard output and the
> Tortoise window.
>   
You really want a client side hook then and there are security issues 
with those.  If your users have Tortoise then you can have client side 
hooks in that which could open a dialog box but it wouldn't work for the 
command line.

S

> What I was trying to do is to use Perl\Tk which is the Perl GUI library,
> and to show the user a message box with the warning. This only got my
> client to get stuck and the commit to fail, and many other problems,
> because there was no message window to the user.
>
> How do I send messages as output of the hook?
>
> Ilan Yaniv
>
> -----Original Message-----
> From: Andy Levy [mailto:andy.levy@gmail.com] 
> Sent: Tuesday, December 16, 2008 4:15 PM
> To: Ilan Yaniv
> Cc: users@subversion.tigris.org
> Subject: Re: perl hooks
>
> On Tue, Dec 16, 2008 at 06:47, Ilan Yaniv <Il...@timetoknow.org>
> wrote:
>   
>> So here is the thing.
>>
>> I have a perl script. It is running OK from command line
>>
>> But when I execute the script from hook (I run in command line svn
>> commit...) nothing happens.
>>
>> Why ?????
>>     
>
> Because on a Windows server, your pre-commit script must be
> pre-commit.bat, pre-commit.exe or pre-commit.cmd. IOW, it must be an
> executable, or a Windows batch file/CMD script which then calls your
> Perl script.
>
> BTW, you seem to have posted a large number of messages on this one
> topic today. Please consider carefully before posting, and post your
> complete message all at once. If you must "continue" a topic, please
> reply to your original post, such that it all appears in one
> discussion thread.
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=985019
>
> To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].
>

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

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

RE: perl hooks

Posted by Ul...@elektrobit.com.
Ilan Yaniv wrote:

> I changed the Perl script to be .exe file. YEEPEE it works.
> Now I want a message to be sent to the committer. Most of the
> people here use Tortoise, but even with command line, I want
> a message to be outputted not only to a log file but also to
> the standard output and the Tortoise window.
> 
> What I was trying to do is to use Perl\Tk which is the Perl
> GUI library, and to show the user a message box with the
> warning. This only got my client to get stuck and the commit
> to fail, and many other problems, because there was no
> message window to the user.
> 
> How do I send messages as output of the hook?

Send the message to STDERR instead of STDOUT and exit with a 
non-zero exit status. The client then gets to decide what it
wants to do. Tortoise shows an error window.

(Success windows are out, afaik - no "thank you for your
submission"-window... ;-))

Best regards,

Ulli


----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.

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

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

RE: perl hooks

Posted by Roger Lipscombe <ro...@1e.com>.
You can't show a message box, because the hooks run on the server. Who's there to see them?

-----Original Message-----
From: Ilan Yaniv [mailto:Ilan.Yaniv@timetoknow.org]
Sent: Tue 16 December 2008 14:21
To: Andy Levy
Cc: users@subversion.tigris.org
Subject: RE: perl hooks

Fine, the reason to all those messages is that I got no answer for the
whole day long, and this is the reason I opened so many questions, sorry
for the trouble.

Next,
I changed the Perl script to be .exe file. YEEPEE it works.
Now I want a message to be sent to the committer. Most of the people
here use Tortoise, but even with command line, I want a message to be
outputted not only to a log file but also to the standard output and the
Tortoise window.

What I was trying to do is to use Perl\Tk which is the Perl GUI library,
and to show the user a message box with the warning. This only got my
client to get stuck and the commit to fail, and many other problems,
because there was no message window to the user.

How do I send messages as output of the hook?

Ilan Yaniv

-----Original Message-----
From: Andy Levy [mailto:andy.levy@gmail.com]
Sent: Tuesday, December 16, 2008 4:15 PM
To: Ilan Yaniv
Cc: users@subversion.tigris.org
Subject: Re: perl hooks

On Tue, Dec 16, 2008 at 06:47, Ilan Yaniv <Il...@timetoknow.org>
wrote:
> So here is the thing.
>
> I have a perl script. It is running OK from command line
>
> But when I execute the script from hook (I run in command line svn
> commit...) nothing happens.
>
> Why ?????

Because on a Windows server, your pre-commit script must be
pre-commit.bat, pre-commit.exe or pre-commit.cmd. IOW, it must be an
executable, or a Windows batch file/CMD script which then calls your
Perl script.

BTW, you seem to have posted a large number of messages on this one
topic today. Please consider carefully before posting, and post your
complete message all at once. If you must "continue" a topic, please
reply to your original post, such that it all appears in one
discussion thread.

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

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


DISCLAIMER:  This is a PRIVATE AND CONFIDENTIAL message for the ordinary user of this email address.  If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery.  NOTE:  Regardless of content, this e-mail shall not operate to bind 1E Ltd to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose.

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

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

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

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


Re: perl hooks

Posted by Toby Thain <to...@telegraphics.com.au>.
On 16-Dec-08, at 9:43 AM, Andy Levy wrote:

> On Tue, Dec 16, 2008 at 09:21, Ilan Yaniv  
> <Il...@timetoknow.org> wrote:
>> ...
>> How do I send messages as output of the hook?
>
> Hook scripts are not interactive. Using a GUI library is a waste of
> your time and may be counterproductive. Send your message to STDERR
> and it will go back to the client AND stop the commit from happening.
> You cannot produce a "warning" in the pre-commit hook - if you send
> output back to the client, it WILL fail the transaction.
>
> If you need to send a "warning" while allowing the hook to end
> successfully, send an email.

Or append to a log file and 'tail -f' on the server to monitor it.

Or use a jabber client* to send alerts back to a multi-user chat (or  
a specific user).

--Toby

e.g. http://www.telegraphics.com.au/svn/jabberbots/trunk/


> "How do I send email in a Perl script?"
> is outside the scope of this mailing list but there are plenty of Perl
> hook scripts you can find via Google which may serve as examples.
>

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

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

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

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

Re: perl hooks

Posted by Toby Thain <to...@telegraphics.com.au>.
On 16-Dec-08, at 9:43 AM, Andy Levy wrote:

> On Tue, Dec 16, 2008 at 09:21, Ilan Yaniv  
> <Il...@timetoknow.org> wrote:
>> ...
>> How do I send messages as output of the hook?
>
> Hook scripts are not interactive. Using a GUI library is a waste of
> your time and may be counterproductive. Send your message to STDERR
> and it will go back to the client AND stop the commit from happening.
> You cannot produce a "warning" in the pre-commit hook - if you send
> output back to the client, it WILL fail the transaction.
>
> If you need to send a "warning" while allowing the hook to end
> successfully, send an email.

Or append to a log file and 'tail -f' on the server to monitor it.

Or use a jabber client* to send alerts back to a multi-user chat (or  
a specific user).

--Toby

e.g. http://www.telegraphics.com.au/svn/jabberbots/trunk/


> "How do I send email in a Perl script?"
> is outside the scope of this mailing list but there are plenty of Perl
> hook scripts you can find via Google which may serve as examples.
>

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

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

Re: perl hooks

Posted by Andy Levy <an...@gmail.com>.
On Tue, Dec 16, 2008 at 09:21, Ilan Yaniv <Il...@timetoknow.org> wrote:
> Fine, the reason to all those messages is that I got no answer for the
> whole day long, and this is the reason I opened so many questions, sorry
> for the trouble.

This is a mailing list of volunteers. You are not guaranteed a
response in a set amount of time - or at all, for that matter. If no
one has an answer, sending the same question many times will not cause
one to be magically created.

Your posts didn't even appear in my inbox till this morning. If
everyone else on the list had the same experience, they couldn't have
replied. If you're in doubt about whether a post made it to the list,
check the archives a few hours after you send it.

> Next,
> I changed the Perl script to be .exe file. YEEPEE it works.
> Now I want a message to be sent to the committer. Most of the people
> here use Tortoise, but even with command line, I want a message to be
> outputted not only to a log file but also to the standard output and the
> Tortoise window.
>
> What I was trying to do is to use Perl\Tk which is the Perl GUI library,
> and to show the user a message box with the warning. This only got my
> client to get stuck and the commit to fail, and many other problems,
> because there was no message window to the user.
>
> How do I send messages as output of the hook?

Hook scripts are not interactive. Using a GUI library is a waste of
your time and may be counterproductive. Send your message to STDERR
and it will go back to the client AND stop the commit from happening.
You cannot produce a "warning" in the pre-commit hook - if you send
output back to the client, it WILL fail the transaction.

If you need to send a "warning" while allowing the hook to end
successfully, send an email. "How do I send email in a Perl script?"
is outside the scope of this mailing list but there are plenty of Perl
hook scripts you can find via Google which may serve as examples.

> -----Original Message-----
> From: Andy Levy [mailto:andy.levy@gmail.com]
> Sent: Tuesday, December 16, 2008 4:15 PM
> To: Ilan Yaniv
> Cc: users@subversion.tigris.org
> Subject: Re: perl hooks
>
> On Tue, Dec 16, 2008 at 06:47, Ilan Yaniv <Il...@timetoknow.org>
> wrote:
>> So here is the thing.
>>
>> I have a perl script. It is running OK from command line
>>
>> But when I execute the script from hook (I run in command line svn
>> commit...) nothing happens.
>>
>> Why ?????
>
> Because on a Windows server, your pre-commit script must be
> pre-commit.bat, pre-commit.exe or pre-commit.cmd. IOW, it must be an
> executable, or a Windows batch file/CMD script which then calls your
> Perl script.
>
> BTW, you seem to have posted a large number of messages on this one
> topic today. Please consider carefully before posting, and post your
> complete message all at once. If you must "continue" a topic, please
> reply to your original post, such that it all appears in one
> discussion thread.
>

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

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

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

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

RE: perl hooks

Posted by Roger Lipscombe <ro...@1e.com>.
You can't show a message box, because the hooks run on the server. Who's there to see them?

-----Original Message-----
From: Ilan Yaniv [mailto:Ilan.Yaniv@timetoknow.org]
Sent: Tue 16 December 2008 14:21
To: Andy Levy
Cc: users@subversion.tigris.org
Subject: RE: perl hooks

Fine, the reason to all those messages is that I got no answer for the
whole day long, and this is the reason I opened so many questions, sorry
for the trouble.

Next,
I changed the Perl script to be .exe file. YEEPEE it works.
Now I want a message to be sent to the committer. Most of the people
here use Tortoise, but even with command line, I want a message to be
outputted not only to a log file but also to the standard output and the
Tortoise window.

What I was trying to do is to use Perl\Tk which is the Perl GUI library,
and to show the user a message box with the warning. This only got my
client to get stuck and the commit to fail, and many other problems,
because there was no message window to the user.

How do I send messages as output of the hook?

Ilan Yaniv

-----Original Message-----
From: Andy Levy [mailto:andy.levy@gmail.com]
Sent: Tuesday, December 16, 2008 4:15 PM
To: Ilan Yaniv
Cc: users@subversion.tigris.org
Subject: Re: perl hooks

On Tue, Dec 16, 2008 at 06:47, Ilan Yaniv <Il...@timetoknow.org>
wrote:
> So here is the thing.
>
> I have a perl script. It is running OK from command line
>
> But when I execute the script from hook (I run in command line svn
> commit...) nothing happens.
>
> Why ?????

Because on a Windows server, your pre-commit script must be
pre-commit.bat, pre-commit.exe or pre-commit.cmd. IOW, it must be an
executable, or a Windows batch file/CMD script which then calls your
Perl script.

BTW, you seem to have posted a large number of messages on this one
topic today. Please consider carefully before posting, and post your
complete message all at once. If you must "continue" a topic, please
reply to your original post, such that it all appears in one
discussion thread.

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

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


DISCLAIMER:  This is a PRIVATE AND CONFIDENTIAL message for the ordinary user of this email address.  If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery.  NOTE:  Regardless of content, this e-mail shall not operate to bind 1E Ltd to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose.

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

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


Re: perl hooks

Posted by Andy Levy <an...@gmail.com>.
On Tue, Dec 16, 2008 at 09:21, Ilan Yaniv <Il...@timetoknow.org> wrote:
> Fine, the reason to all those messages is that I got no answer for the
> whole day long, and this is the reason I opened so many questions, sorry
> for the trouble.

This is a mailing list of volunteers. You are not guaranteed a
response in a set amount of time - or at all, for that matter. If no
one has an answer, sending the same question many times will not cause
one to be magically created.

Your posts didn't even appear in my inbox till this morning. If
everyone else on the list had the same experience, they couldn't have
replied. If you're in doubt about whether a post made it to the list,
check the archives a few hours after you send it.

> Next,
> I changed the Perl script to be .exe file. YEEPEE it works.
> Now I want a message to be sent to the committer. Most of the people
> here use Tortoise, but even with command line, I want a message to be
> outputted not only to a log file but also to the standard output and the
> Tortoise window.
>
> What I was trying to do is to use Perl\Tk which is the Perl GUI library,
> and to show the user a message box with the warning. This only got my
> client to get stuck and the commit to fail, and many other problems,
> because there was no message window to the user.
>
> How do I send messages as output of the hook?

Hook scripts are not interactive. Using a GUI library is a waste of
your time and may be counterproductive. Send your message to STDERR
and it will go back to the client AND stop the commit from happening.
You cannot produce a "warning" in the pre-commit hook - if you send
output back to the client, it WILL fail the transaction.

If you need to send a "warning" while allowing the hook to end
successfully, send an email. "How do I send email in a Perl script?"
is outside the scope of this mailing list but there are plenty of Perl
hook scripts you can find via Google which may serve as examples.

> -----Original Message-----
> From: Andy Levy [mailto:andy.levy@gmail.com]
> Sent: Tuesday, December 16, 2008 4:15 PM
> To: Ilan Yaniv
> Cc: users@subversion.tigris.org
> Subject: Re: perl hooks
>
> On Tue, Dec 16, 2008 at 06:47, Ilan Yaniv <Il...@timetoknow.org>
> wrote:
>> So here is the thing.
>>
>> I have a perl script. It is running OK from command line
>>
>> But when I execute the script from hook (I run in command line svn
>> commit...) nothing happens.
>>
>> Why ?????
>
> Because on a Windows server, your pre-commit script must be
> pre-commit.bat, pre-commit.exe or pre-commit.cmd. IOW, it must be an
> executable, or a Windows batch file/CMD script which then calls your
> Perl script.
>
> BTW, you seem to have posted a large number of messages on this one
> topic today. Please consider carefully before posting, and post your
> complete message all at once. If you must "continue" a topic, please
> reply to your original post, such that it all appears in one
> discussion thread.
>

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

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

RE: perl hooks

Posted by Ilan Yaniv <Il...@timetoknow.org>.
Fine, the reason to all those messages is that I got no answer for the
whole day long, and this is the reason I opened so many questions, sorry
for the trouble.

Next,
I changed the Perl script to be .exe file. YEEPEE it works.
Now I want a message to be sent to the committer. Most of the people
here use Tortoise, but even with command line, I want a message to be
outputted not only to a log file but also to the standard output and the
Tortoise window.

What I was trying to do is to use Perl\Tk which is the Perl GUI library,
and to show the user a message box with the warning. This only got my
client to get stuck and the commit to fail, and many other problems,
because there was no message window to the user.

How do I send messages as output of the hook?

Ilan Yaniv

-----Original Message-----
From: Andy Levy [mailto:andy.levy@gmail.com] 
Sent: Tuesday, December 16, 2008 4:15 PM
To: Ilan Yaniv
Cc: users@subversion.tigris.org
Subject: Re: perl hooks

On Tue, Dec 16, 2008 at 06:47, Ilan Yaniv <Il...@timetoknow.org>
wrote:
> So here is the thing.
>
> I have a perl script. It is running OK from command line
>
> But when I execute the script from hook (I run in command line svn
> commit...) nothing happens.
>
> Why ?????

Because on a Windows server, your pre-commit script must be
pre-commit.bat, pre-commit.exe or pre-commit.cmd. IOW, it must be an
executable, or a Windows batch file/CMD script which then calls your
Perl script.

BTW, you seem to have posted a large number of messages on this one
topic today. Please consider carefully before posting, and post your
complete message all at once. If you must "continue" a topic, please
reply to your original post, such that it all appears in one
discussion thread.

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

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

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

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


RE: perl hooks

Posted by Ilan Yaniv <Il...@timetoknow.org>.
Fine, the reason to all those messages is that I got no answer for the
whole day long, and this is the reason I opened so many questions, sorry
for the trouble.

Next,
I changed the Perl script to be .exe file. YEEPEE it works.
Now I want a message to be sent to the committer. Most of the people
here use Tortoise, but even with command line, I want a message to be
outputted not only to a log file but also to the standard output and the
Tortoise window.

What I was trying to do is to use Perl\Tk which is the Perl GUI library,
and to show the user a message box with the warning. This only got my
client to get stuck and the commit to fail, and many other problems,
because there was no message window to the user.

How do I send messages as output of the hook?

Ilan Yaniv

-----Original Message-----
From: Andy Levy [mailto:andy.levy@gmail.com] 
Sent: Tuesday, December 16, 2008 4:15 PM
To: Ilan Yaniv
Cc: users@subversion.tigris.org
Subject: Re: perl hooks

On Tue, Dec 16, 2008 at 06:47, Ilan Yaniv <Il...@timetoknow.org>
wrote:
> So here is the thing.
>
> I have a perl script. It is running OK from command line
>
> But when I execute the script from hook (I run in command line svn
> commit...) nothing happens.
>
> Why ?????

Because on a Windows server, your pre-commit script must be
pre-commit.bat, pre-commit.exe or pre-commit.cmd. IOW, it must be an
executable, or a Windows batch file/CMD script which then calls your
Perl script.

BTW, you seem to have posted a large number of messages on this one
topic today. Please consider carefully before posting, and post your
complete message all at once. If you must "continue" a topic, please
reply to your original post, such that it all appears in one
discussion thread.

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

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


Re: perl hooks

Posted by Andy Levy <an...@gmail.com>.
On Tue, Dec 16, 2008 at 06:47, Ilan Yaniv <Il...@timetoknow.org> wrote:
> So here is the thing.
>
> I have a perl script. It is running OK from command line
>
> But when I execute the script from hook (I run in command line svn
> commit...) nothing happens.
>
> Why ?????

Because on a Windows server, your pre-commit script must be
pre-commit.bat, pre-commit.exe or pre-commit.cmd. IOW, it must be an
executable, or a Windows batch file/CMD script which then calls your
Perl script.

BTW, you seem to have posted a large number of messages on this one
topic today. Please consider carefully before posting, and post your
complete message all at once. If you must "continue" a topic, please
reply to your original post, such that it all appears in one
discussion thread.

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

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

Re: perl hooks

Posted by Andy Levy <an...@gmail.com>.
On Tue, Dec 16, 2008 at 06:47, Ilan Yaniv <Il...@timetoknow.org> wrote:
> So here is the thing.
>
> I have a perl script. It is running OK from command line
>
> But when I execute the script from hook (I run in command line svn
> commit...) nothing happens.
>
> Why ?????

Because on a Windows server, your pre-commit script must be
pre-commit.bat, pre-commit.exe or pre-commit.cmd. IOW, it must be an
executable, or a Windows batch file/CMD script which then calls your
Perl script.

BTW, you seem to have posted a large number of messages on this one
topic today. Please consider carefully before posting, and post your
complete message all at once. If you must "continue" a topic, please
reply to your original post, such that it all appears in one
discussion thread.

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

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

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

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

Re: perl hooks

Posted by David Weintraub <qa...@gmail.com>.
Please make sure you send replies to the entire list...

I assume you are talking about "svnlook cat" and not "svnlook cut".

Where are you outputting this file? If you are sending the output to a
program that may use HTML commands, you might find that it recognizes
the "<" and ">" as HTML tag markers and ignore their contents. If this
is the case, you must convert "<" to "&lt;" before sending it to the
program and ">" to &gt;".

There shouldn't be any reason you to have this problem if you are
printing the output to a file or to the console window.

On Wed, Dec 17, 2008 at 9:04 AM, Ilan Yaniv <Il...@timetoknow.org> wrote:
> Hi David,
>
> Everything worked fine.
> I have moved on with the exe (originated from perl) and I output info
> into STDERR.
>
> But now I want to see the file content that I have just commited.
>
> So I am running the command:
> Svnlook cut <REPOS_PATH> <FILE_PATH>
> And I got the output wrong.
> This is an xml file, and whenever I get lines with Tags
> eg.<a>aaa</aaa>
> the line is ignored
>
> WHY?
>
> -----Original Message-----
> From: David Weintraub [mailto:qazwart@gmail.com]
> Sent: Tuesday, December 16, 2008 7:57 PM
> To: Ilan Yaniv
> Subject: Re: perl hooks
>
> Ilan:
>
> Please don't send out so many emails to the list on the same topic.
> This is a volunteer list, and most people who respond are probably
> based in the U.S., so you might have to wait a few hours until you get
> an answer.
>
> If you send out repeated queries on the same topic, you'll find your
> emails being considered spam, and going directly into people's
> trashcan.
>
> I've answered this query from another email you sent out. Subversion
> server side pre-commit hooks don't communicate with the client unless
> you exit the pre-commit hook script with an exit code other than zero.
> In that case, it will send the user what was printed out via STDERR,
> and stop the commit operation.
>
> If you merely want to send users information, and not want to stop a
> commit, consider a post-commit hook. You can also use email or IM
> messaging to let users know information during the transaction too.
> Take a look at the NET::AIM Perl extension:
> http://search.cpan.org/~aryeh/Net-AIM-1.22/AIM.pm.
>
> I also mentioned in my other email about the PATHEXT environment
> variable. Adding .pl to this will allow you to treat Perl scripts on
> the same level as Batch and executables.
>
> On Tue, Dec 16, 2008 at 6:47 AM, Ilan Yaniv <Il...@timetoknow.org>
> wrote:
>> So here is the thing.
>>
>> I have a perl script. It is running OK from command line
>>
>> But when I execute the script from hook (I run in command line svn
>> commit...) nothing happens.
>>
>> Why ?????
>>
>> Ilan Yaniv
>>
>> Configuration Management
>>
>> Phone: 03-7534333 ext. 5873
>>
>> Ilan.Yaniv@timetoknow.org
>
>
>
> --
> --
> David Weintraub
> qazwart@gmail.com
>



-- 
--
David Weintraub
qazwart@gmail.com

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

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

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

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

Re: perl hooks

Posted by David Weintraub <qa...@gmail.com>.
Please make sure you send replies to the entire list...

I assume you are talking about "svnlook cat" and not "svnlook cut".

Where are you outputting this file? If you are sending the output to a
program that may use HTML commands, you might find that it recognizes
the "<" and ">" as HTML tag markers and ignore their contents. If this
is the case, you must convert "<" to "&lt;" before sending it to the
program and ">" to &gt;".

There shouldn't be any reason you to have this problem if you are
printing the output to a file or to the console window.

On Wed, Dec 17, 2008 at 9:04 AM, Ilan Yaniv <Il...@timetoknow.org> wrote:
> Hi David,
>
> Everything worked fine.
> I have moved on with the exe (originated from perl) and I output info
> into STDERR.
>
> But now I want to see the file content that I have just commited.
>
> So I am running the command:
> Svnlook cut <REPOS_PATH> <FILE_PATH>
> And I got the output wrong.
> This is an xml file, and whenever I get lines with Tags
> eg.<a>aaa</aaa>
> the line is ignored
>
> WHY?
>
> -----Original Message-----
> From: David Weintraub [mailto:qazwart@gmail.com]
> Sent: Tuesday, December 16, 2008 7:57 PM
> To: Ilan Yaniv
> Subject: Re: perl hooks
>
> Ilan:
>
> Please don't send out so many emails to the list on the same topic.
> This is a volunteer list, and most people who respond are probably
> based in the U.S., so you might have to wait a few hours until you get
> an answer.
>
> If you send out repeated queries on the same topic, you'll find your
> emails being considered spam, and going directly into people's
> trashcan.
>
> I've answered this query from another email you sent out. Subversion
> server side pre-commit hooks don't communicate with the client unless
> you exit the pre-commit hook script with an exit code other than zero.
> In that case, it will send the user what was printed out via STDERR,
> and stop the commit operation.
>
> If you merely want to send users information, and not want to stop a
> commit, consider a post-commit hook. You can also use email or IM
> messaging to let users know information during the transaction too.
> Take a look at the NET::AIM Perl extension:
> http://search.cpan.org/~aryeh/Net-AIM-1.22/AIM.pm.
>
> I also mentioned in my other email about the PATHEXT environment
> variable. Adding .pl to this will allow you to treat Perl scripts on
> the same level as Batch and executables.
>
> On Tue, Dec 16, 2008 at 6:47 AM, Ilan Yaniv <Il...@timetoknow.org>
> wrote:
>> So here is the thing.
>>
>> I have a perl script. It is running OK from command line
>>
>> But when I execute the script from hook (I run in command line svn
>> commit...) nothing happens.
>>
>> Why ?????
>>
>> Ilan Yaniv
>>
>> Configuration Management
>>
>> Phone: 03-7534333 ext. 5873
>>
>> Ilan.Yaniv@timetoknow.org
>
>
>
> --
> --
> David Weintraub
> qazwart@gmail.com
>



-- 
--
David Weintraub
qazwart@gmail.com

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

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