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

RE: Problem with post-commit hook script

From: Andy Buchanan <Andy.Buchanan_at_artworks.co.uk>
Date: 2003-07-14 18:43:43 CEST

Thanks for those who replied. It seems my EXE stub _was_ being called after
all, but was confused about paths. At least as confused as I was :-)

It all works works now.

If anyones interested heres the stub I put together.

post-commit.command:
d:/SVNRepos/DJ/hooks/post-commit-email.pl

WinShellExec.exe renamed to post-commit.exe:

WinShellExec.cpp:
//
// WinShellExec
//
// This program executes the program/script in the file X.command
// where X.exe is the name of this program
//
// Command should not include any parameters, but parameters
// used with X.command will be passed on.
//

#include <iostream>

#include <istream>
#include <fstream>

#include <string>

#include <windows.h>

int main( int argc, char* argv[] )
{
        std::string commandfile = argv[0];

        // Work out name of command file
        if ( std::string::npos == commandfile.find_last_of( '.' ) ) return
-1;
        commandfile.erase( commandfile.find_last_of( '.' ) );
        commandfile.append( ".command" );

        std::ifstream file( commandfile.c_str() );
        if ( !file ) return -1;

        std::string commandtext;

        // don't like the .readline() method so do this instead
        while ( true )
        {
                std::string word;
                file >> word;
                if ( file.eof() ) break;
                
                if ( !commandtext.empty() ) commandtext += " ";
                commandtext += word;
        }

        // Args
        std::string args;
        for ( int i=1; i<argc; i++ )
        {
                if ( !args.empty() ) args += " ";
                args.append( argv[i] );
        }

        ShellExecute( NULL, "open", commandtext.c_str(), args.c_str(), NULL,
SW_HIDE );
        return 0;
}

-----Original Message-----
From: Branko Cibej [mailto:brane@xbc.nu]
Sent: 14 July 2003 16:26
To: D.J. Heap
Cc: 'Andy Buchanan'; dev@subversion.tigris.org
Subject: Re: Problem with post-commit hook script

D.J. Heap wrote:

>Hmm, I'm using a post-commit.cmd that seems to be working well on WinXP
>and Win2003 -- it just spins off a hot-backup.py, though. Is it
>redirection that is broken? I haven't tried anything fancy yet.
>
I guess it's possible it works on XP, but not on 2k; either that, or
apr_create_process with APR_PROGRAM or APR_PROGRAM_PATH has been fixed
since the last time I tried this. It used to be that for .cmd or .bat
scripts, you needed APR_SHELLCMD.

>
>DJ
>
>-----Original Message-----
>From: Branko Cibej [mailto:brane@xbc.nu]
>Sent: Monday, July 14, 2003 9:13 AM
>To: Andy Buchanan
>Cc: 'dev@subversion.tigris.org'
>Subject: Re: Problem with post-commit hook script
>
>[snip]
>
>We "support" .exe, .cmd and .bat extensions; post-commit.exe should
>work, it does for me. Post-commit.bat (or .cmd) won't work because we
>don't call the script correctly -- that's s bug in Subversion. Perl
>scripts won't work at all.
>
>
>
>

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jul 14 18:49:23 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.