[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: Tom Malia <tommalia_at_ttdsinc.com>
Date: 2007-08-15 18:50:57 CEST

Thanks for the response. So this sounds like a real headache. I suppose I
could install Perl on the machine and use Perl scripts but I hate having to
juggle a dozen different languages if I don't have to.

Do you happen to know if you can write VB6 EXE's that will work as command
hook programs? I know that VB6 has the same problem when it comes to the
fact that it's actually running inside it's own virtual machine so I'm not
sure if it can properly take command line arguments and return the correct
exit codes... but if it could that would be a lot easier for me.

What about "Bash" on windows? What would I need to do to be able to run the
Bash files as they are in windows? I assume something can be installed to
allow this?

Thanks in advance,
Tom Malia

-----Original Message-----
From: Andy Levy [mailto:andy.levy@gmail.com]
Sent: Wednesday, August 15, 2007 11:46 AM
To: Tom Malia
Cc: users@subversion.tigris.org
Subject: Re: Using VBScript for hooks? pre-revprop-change.vbs?

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 18:48:21 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.