How to get svn revision in ant using tortoise
This post is for you who are using Tortoise in windows environment and want to get the highest committed revision number when running an ant build script. This number can be useful when handling the version of the static files/contents. Here is a simple ant target
<target name="get-revision"> <exec executable="subWCRev.exe"> <arg value="${srcBaseDir}"/> <arg value="${srcBaseDir}/revision.build"/> <arg value="${srcBaseDir}/deploy/revision.properties"/> </exec> </target>
Where ${srcBaseDir} is the top directory of svn checkout (working copy), ${srcBaseDir}/revision.build is the template file and ${srcBaseDir}/deploy/revision.properties is the output file.
And content of the file revision.build
common.svn.revision = $WCREV$
Where $WCREV$ is the placeholder for the highest committed revision number. You can find more placeholders by running subWCRev.exe in cmd-promt.
The output to the file revision.properties will be, for instance
common.svn.revision = 1001
Enjoy!
[...] is aimed to you whom use svn in linux environment. If you are using windows and Tortoise this post may be more [...]