You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Floris van der Ploeg <fv...@xs4all.nl> on 2008/01/15 11:17:26 UTC

using custom hooks

Is there a way to use PowerShell Scripts as Hook Scripts?

Changing the Filetype Association for .ps1 files didn't do the job.
Currently, I've create a workaround by kicking off a cmd script which, in
turn, runs the PowerShell.exe command and passes the arguments. This,
however, doesn't return the correct exit code from my PowerShell script.

So there could be 2 possible solutions:

1. enabling powershell support for hook scripts
2. passing the exit code from the powershell script to the cmd script (but
does anybody know how to do this??)

Thanks in advance!

kind regards,
Floris van der Ploeg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: using custom hooks

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jan 15, 2008, at 05:17, Floris van der Ploeg wrote:

> Is there a way to use PowerShell Scripts as Hook Scripts?
>
> Changing the Filetype Association for .ps1 files didn't do the job.
> Currently, I've create a workaround by kicking off a cmd script  
> which, in
> turn, runs the PowerShell.exe command and passes the arguments.

That's the way to do it.

> This, however, doesn't return the correct exit code from my PowerShell
> script.
>
> So there could be 2 possible solutions:
>
> 1. enabling powershell support for hook scripts
> 2. passing the exit code from the powershell script to the cmd  
> script (but
> does anybody know how to do this??)

I'm afraid I'm not familiar with Windows scripting.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: Re: using custom hooks

Posted by "Thompson, Graeme (GE Infra, Aviation)" <Gr...@ge.com>.
If powershell returns an exit code via the standard errorlevel mechanism
then something like:

EXIT %errorlevel%

would exit the command interpreter with the error level returned from
the powershell and should get back to subversion.

It works at the command prompt but I have not tried this with SVN though
as I have subversion running on SUSE Linux.....

HTH,

Graeme

-----Original Message-----
From: Andy Levy [mailto:andy.levy@gmail.com] 
Sent: 15 January 2008 12:03
To: fvdploeg@xs4all.nl
Cc: users@subversion.tigris.org
Subject: Re: using custom hooks

On Jan 15, 2008 6:17 AM, Floris van der Ploeg <fv...@xs4all.nl>
wrote:
> Is there a way to use PowerShell Scripts as Hook Scripts?
>
> Changing the Filetype Association for .ps1 files didn't do the job.
> Currently, I've create a workaround by kicking off a cmd script which,

> in turn, runs the PowerShell.exe command and passes the arguments. 
> This, however, doesn't return the correct exit code from my PowerShell
script.
>
> So there could be 2 possible solutions:
>
> 1. enabling powershell support for hook scripts

I poked around at this about a year ago with a couple SVN devs, though
it was for WSH scripts (.WSH extension), not PowerShell. Ultimately we
came to the conclusion that it wasn't practical; because an interpreter
was required, we had to specify the full path to that interpreter, and
that can vary from system to system. Went back to the solution you're
using now.

> 2. passing the exit code from the powershell script to the cmd script 
> (but does anybody know how to do this??)

That's a CMD.exe or maybe batch question I think. I'm sure MS has it
documented but TechNet doesn't seem to  like Safari.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


______________________________________________________________________
CAUTION: This message was sent via the Public Internet and its
authenticity cannot be guaranteed. 

______________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: using custom hooks

Posted by Andy Levy <an...@gmail.com>.
On Jan 15, 2008 6:17 AM, Floris van der Ploeg <fv...@xs4all.nl> wrote:
> Is there a way to use PowerShell Scripts as Hook Scripts?
>
> Changing the Filetype Association for .ps1 files didn't do the job.
> Currently, I've create a workaround by kicking off a cmd script which, in
> turn, runs the PowerShell.exe command and passes the arguments. This,
> however, doesn't return the correct exit code from my PowerShell script.
>
> So there could be 2 possible solutions:
>
> 1. enabling powershell support for hook scripts

I poked around at this about a year ago with a couple SVN devs, though
it was for WSH scripts (.WSH extension), not PowerShell. Ultimately we
came to the conclusion that it wasn't practical; because an
interpreter was required, we had to specify the full path to that
interpreter, and that can vary from system to system. Went back to the
solution you're using now.

> 2. passing the exit code from the powershell script to the cmd script (but
> does anybody know how to do this??)

That's a CMD.exe or maybe batch question I think. I'm sure MS has it
documented but TechNet doesn't seem to  like Safari.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: using custom hooks

Posted by "Reedick, Andrew" <jr...@ATT.COM>.
> -----Original Message-----
> From: Floris van der Ploeg [mailto:fvdploeg@xs4all.nl]
> Sent: Tuesday, January 15, 2008 6:17 AM
> To: users@subversion.tigris.org
> Subject: using custom hooks
> 
> Is there a way to use PowerShell Scripts as Hook Scripts?
> 
> Changing the Filetype Association for .ps1 files didn't do the job.
> Currently, I've create a workaround by kicking off a cmd script which,
> in
> turn, runs the PowerShell.exe command and passes the arguments. This,
> however, doesn't return the correct exit code from my PowerShell
> script.
> 
> So there could be 2 possible solutions:
> 
> 1. enabling powershell support for hook scripts
> 2. passing the exit code from the powershell script to the cmd script
> (but
> does anybody know how to do this??)
> 

Google knows everything.  A search on "powershell exit code" came back
with:
http://blogs.msdn.com/powershell/archive/2006/10/14/Windows-PowerShell-E
xit-Codes.aspx


Although it's odd that you're having a problem in the first place since
the cmd.exe should already receive the exit code.  The 'if errorlevel'
has been around since the early days of DOS, but it's always been
exceeding clumsy:   	

	some.exe
	rem errorlevel 1 will catch 1 or higher
	If errorlevel 1 goto FAILED
	rem errorlevel 0 will catch 0 or higher
	If errorlevel 0 goto SUCCESS

	:FAILED
	exit 1

	:SUCCESS
	exit 0



*****

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA623


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org