Exporting from Subversion with Phing
A minor triumph today. I managed to get phing to export some code from a Subversion repository without any of the pain usually involved in such tasks. I was trying to get phing to export to an already existing directory - for reasons I'll not go into here.
As a very basic test, I created an extremely simple build file first:
<project name="test_export" default="build">
<target name="build">
<svnexport todir="/opt/phing/test_exp"
repositoryurl="file:///srv/svn/repos/streamonline/trunk/css" />
</target>
</project>
I then ran the file with the following command, getting this:
[raz@ballbreaker phing]# phing -f /opt/phing/build_files/test_exp.xml Buildfile: /opt/phing/build_files/test_exp.xml test_export > build: [svnexport] Exporting SVN repository to '/opt/phing/test_exp' Execution of target "build" failed for the following reason: /opt/phing/build_files/test_exp.xml:4:31: Failed to run the 'svn export' command: svn: '/opt/phing/test_exp' already exists (cmd: /usr/bin/svn export --non-interactive file:///srv/svn/repos/streamonline/trunk/css /opt/phing/test_exp) BUILD FAILED /opt/phing/build_files/test_exp.xml:4:31: Failed to run the 'svn export' command: svn: '/opt/phing/test_exp' already exists (cmd: /usr/bin/svn export --non-interactive file:///srv/svn/repos/streamonline/trunk/css /opt/phing/test_exp) Total time: 0.2062 seconds [raz@ballbreaker phing]#
This was a bit of a bugbear for a while until I realised that one has to force the operation to take place because the destination directory already existed - so I added the "force=true" attribute to the svnexport task in the build file... It is worth noting that this little feature was not documented in the Phing documentation.
<project name="test_export" default="build">
<target name="build">
<svnexport todir="/opt/phing/test_exp" force="true"
repositoryurl="file:///srv/svn/repos/streamonline/trunk/css" />
</target>
</project>
Ran it again...
[raz@ballbreaker phing]# phing -f /opt/phing/build_files/test_exp.xml Buildfile: /opt/phing/build_files/test_exp.xml test_export > build: [svnexport] Exporting SVN repository to '/opt/phing/test_exp' BUILD FINISHED Total time: 0.2125 seconds [raz@ballbreaker phing]#
Splendid!
About this entry
You’re currently reading “ Exporting from Subversion with Phing ,” an entry on chris ramsay
- Published:
- 5.29.07 / 11am
- Category:
- PHP, Phing, Programming










2 Comments
Jump to comment form | comments rss [?] | trackback uri [?]