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

Re: Subversion - .wsf hook scripts on Windows

From: Daniel Rall <dlr_at_collab.net>
Date: 2007-01-17 00:54:23 CET

On Tue, 16 Jan 2007, Andy Levy wrote:

> On 1/8/07, Lieven Govaerts <svnlgo@mobsol.be> wrote:
> >Andy Levy wrote:
> >>
> >> It may take me a couple days to get a build environment set up at home
> >> (Subversion isn't my primary responsibility at work, so I need to
> >> approach this as more of a personal project). If I can contribute
> >> something useful back to Subversion, it'd be a great feeling.
>
> >If you can send me a simple .wsf pre-commit hook script which you think
> >should work I'll test here.
>
> Sorry about the delay. I was unsuccessful in getting Subversion built
> on my home system and I've had no time over the last couple weeks to
> figure out how to get it working.
>
> Attached is a WSF script which iterates through all unnamed arguments
> passed in and appends them to a textfile c:\hook.txt. It then iterates
> through named arguments and does the same. It's not particularly
> "clean" or elegant, but it gets the job done.

> <?xml version="1.0"?>
> <package>
>
> <job id="main">
> <comment>
> </comment>
> <runtime>
> <description>
> Pre-commit hook script
> </description>
> <example>
> </example>
> </runtime>
> <reference object="Scripting.FileSystemObject"/>
> <script language="JScript">
> <![CDATA[
> var FOR_APPENDING = 8;
> var oFSO = new ActiveXObject("Scripting.FileSystemObject");
> WriteTextFile("c:\\logs\\hook.txt", "***********");
> var namedArgs = new Enumerator(WScript.Arguments.Named);
> for (namedArgs;!namedArgs.atEnd();namedArgs.moveNext()) {
> WriteTextFile("c:\\hook.txt", "Item: " + namedArgs.item());
> }
> var unNamedArgs = new Enumerator(WScript.Arguments.Unnamed);
> for (unNamedArgs;!unNamedArgs.atEnd();unNamedArgs.moveNext()) {
> WriteTextFile("c:\\hook.txt", "Item: " + unNamedArgs.item());
> }
> WScript.Quit(1);
> function WriteTextFile(strFileName, strOutput) {
> /*
> Writes data out to the specified file
> If the file already exists, the data is appended
> Otherwise, a new file is created
> */
>
> var objTextStream;
> // Open text file for output.
> if (oFSO.FileExists(strFileName)) {
> objTextStream = oFSO.OpenTextFile(strFileName, FOR_APPENDING);
> } else {
> objTextStream = oFSO.CreateTextFile(strFileName);
> }
>
> // Write data to file.
> objTextStream.WriteLine(strOutput);
>
> objTextStream.Close();
>
> }
>
> ]]>
> </script>
> </job>
> </package>

Lieven, can you verify this? If it's a problem, and can't be
addressed by way of Windows system configuration, we have the options
of:

o Removing the wsf extension from the supported hook file extension list

o Special-case wsf files on Windows to run them using cscript.exe

Thanks, Dan

  • application/pgp-signature attachment: stored
Received on Wed Jan 17 00:54:33 2007

This is an archived mail posted to the Subversion Dev mailing list.