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

[Subclipse-users] Svnant fails when run as hook

From: Johannes Braunias <Johannes.Braunias_at_sonydadc.com>
Date: 2007-11-23 11:36:12 CET

Good day!

I'm experiencing the following problem:
I want to copy files out of a repository to a folder, after a commit is
executed.
I implemented therefore the following ant task as a post-commit hook.
(All on a Windows system.)

When executing the task from the command line, this works fine.
When executing it as a hook in the post-commit batch, it fails.

The only difference: from command line, it runs on my user account, when
executing as a hook, it runs as the SYSTEM user.
The Path variable is available (set in the hook batch file). Hmm, other
variables needed?
After a commit, ant starts, but the "svn" process hangs. When it is
killed, the rest of the ant log file is written.

Anyone out there to help me?!
Thanks a lot.

Jo

### Ant file:
<project name="post-commit-hook" default="testtask" basedir=".">
        <property name="dir-source" location="c:\temp\repcopy"/>
        <property name="dir-dest" location="c:\temp\dist"/>
        <property name="repos" value="____"/>
        <property name="rev" value="____"/>
 
        <property environment="env"/>

        <typedef resource="svntask.properties"/> <!--
Alternativsyntax: <taskdef name="svn"
classname="org.tigris.subversion.svnant.SvnTask"/> -->

        <target name="testtask">
                <!--<echo message="Repository: ${repos} Revision: ${rev}"
file="c:\temp\antausgabe.txt"/>-->
                <echo message="Environment: ${env.Path}"
file="d:\data\svn\repository\hooks\post-commit\log\echo.txt"/>
 
                <svn javahl="false" username="jbraunia"
password="jbrauniaSVN">
                        <export srcUrl="http://localhost/svn/test"
destPath="c:\temp\rrrrrraus" revision="${rev}" force="true"/>
                </svn>
        </target>
</project>

### post-commit.bat (exporting revision 30):
set REPOS=%1
set REV=%2
set ANT_HOME=C:\Programme\apache-ant-1.7.0
set JAVA_HOME=C:\Programme\Java\jre1.6.0_02
set SVN_HOME=C:\Programme\svn-win32-1.4.5
set PATH=%PATH%;%ANT_HOME%\bin
set PATH=%PATH%;%SVN_HOME%\bin
ant -f D:\data\svn\repository\hooks\post-commit\post-commit-test.xml
-Drepos=%REPOS% -Drev=30 -logfile
d:\data\svn\repository\hooks\post-commit\log\ant.log

### Manual execution of the ant file (repository parameter set):
ant -f D:\data\svn\repository\hooks\post-commit\post-commit-test.xml
-Drepos=d:\data\svn\repository\ -Drev=30 -logfile
d:\data\svn\repository\hooks\post-commit\log\ant.log

### Ant log file (after failed execution):
testtask:
      [svn] Using command line interface
Svn : Exporting
export -r 30 http://localhost/svn/test c:\temp\rrrrrraus --force
>>>> svn process killed manually
Authentication realm: <http://localhost:80> Test Repository

BUILD FAILED
D:\data\svn\repository\hooks\post-commit\post-commit-test.xml:26: Can't
export

Total time: 20 seconds

### Ant log file (after successful manual execution):
testtask:
      [svn] Using command line interface
Svn : Exporting
export -r 30 http://localhost/svn/test c:\temp\rrrrrraus --force
A C:\temp\rrrrrraus
A C:\temp\rrrrrraus\neu11556405.OLD
A C:\temp\rrrrrraus\neu11558869.OLD
A C:\temp\rrrrrraus\1
A C:\temp\rrrrrraus\neu11557236.OLD
A C:\temp\rrrrrraus\neu11556635.OLD
A C:\temp\rrrrrraus\neu11557742.OLD
A C:\temp\rrrrrraus\neu11558048.OLD
A C:\temp\rrrrrraus\neu11557349.OLD
A C:\temp\rrrrrraus\neu11558276.OLD
A C:\temp\rrrrrraus\neu11556111.OLD
A C:\temp\rrrrrraus\neu11557855.OLD
A C:\temp\rrrrrraus\neu11556876.OLD
A C:\temp\rrrrrraus\neu11555887.OLD
Exported revision 30.

BUILD SUCCESSFUL
Total time: 1 second
Received on Fri Nov 23 11:36:42 2007

This is an archived mail posted to the Subclipse Users mailing list.

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