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

Re: Using VBScript for hooks? pre-revprop-change.vbs?

From: Andy Levy <andy.levy_at_gmail.com>
Date: 2007-08-15 17:45:32 CEST

On 8/15/07, Tom Malia <tommalia@ttdsinc.com> wrote:
> I'm trying to write a pre-revprop-change hook using VBScript (Trying to
> implement svnsync)
> The problem I'm having is, Subversion doesn't appear to be finding the file.
> If I name the file: pre-revprop-change.vbs
> And I run svnsync initialize it acts as if the hook script is not there.
> If I name the file: pre-revprop-change.wsf
> And I run svnsync initialize it tells me that it "failed to start" the
> script file.
> I assume the issue with wsf is that I don't have the Microsoft component
> that actually runs wsf files properly installed/registered. I'm hoping that
> is irrelevant though because I'd rather be able to just use VBS files.
> Why does it seem like Subversion is not looking for the: VBS version of the
> file?
> p.s. It would be really nice if the standard hooks directory contained a
> complete set of VBScript template files for us non-UNIX folks along with the
> template Bash scripts.

I went down this path earlier this year. The short version is that VBS
files are not themselves executable as far as Windows is concerned -
they require being run through an interpreter.

The Subversion libraries look for the hook name followed by a "known
executable extension" on Windows - .bat, .exe and .cmd. So you're
right - Subversion isn't looking for the VBS version of the file. I
don't recall the state of WSF support but I'm fairly sure it doesn't
work either for the same reason.

The trouble is that because these scripts require an interpreter, the
library needs to call "path\to\cscript.exe HOOKNAME.vbs|wsf" and that
path to cscript.exe isn't the same on every system, and hook scripts
run with an empty environment so you can't rely upon the one in %PATH%
(because %PATH% is minimal or empty).

You also (to my knowledge) can't pass parameters to "bare" .VBS files,
but you can with WSF. I may be wrong though.

So...as a workaround, you can write a one-line .BAT file which calls
path\to\cscript.exe path\to\hookname.VBS %1 %2 %3 etc. - basically
passing the same parameters into that script which were passed into
the batchfile. I'm not sure how well that'll work with passing
messages back to the client, as I haven't implemented hook scripts in
WSH yet (once I get time away from my primary duties in the office, I
will hopefully be doing so).

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Aug 15 17:43:34 2007

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.