Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using ant svn task to get the version of a working copy?

Tags:

java

svn

ant

Is there a way use the svn ant task to get the svn revision number of a working copy and put it into a variable?

I would like to add an entry in my Java manifest file which includes the svn revision number, e.g. 0.9.65361 where 65361 is the revision number.

like image 335
Jason S Avatar asked Aug 19 '14 18:08

Jason S


People also ask

How do I checkout a specific version of svn?

Specify the subversion repository URL to check out, such as "https://svn.apache.org/repos/asf/ant/". You can also add "@NNN" at the end of the URL to check out a specific revision number, if that's desirable.

How do I find previous versions in svn?

By far the easiest way to revert the changes from one or more revisions, is to use the revision log dialog. Select the file or folder in which you need to revert the changes. If you want to revert all changes, this should be the top level folder. Select TortoiseSVN → Show Log to display a list of revisions.

How does svn revision number work?

Unlike most version control systems, Subversion's revision numbers apply to the entire repository tree, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change.

What is a revision in svn?

Every time you commit a set of changes, you create one new “revision” in the repository. Each revision represents the state of the repository tree at a certain point in its history. If you want to go back in time you can examine the repository as it was at revision N.


1 Answers

Aha, I found this idea, which depends only on the svnversion command-line utility in SVN.

<project name="ant-exec-example" default="svnversion" basedir=".">
  <target name="svnversion">
    <exec executable="svnversion" outputproperty="svnversion" />
    <echo message="SVN Version: ${svnversion}"/>
  </target>
</project>

Here's where it captures the version in an ant property:

<exec executable="svnversion" outputproperty="svnversion" />
like image 82
Jason S Avatar answered Nov 15 '22 04:11

Jason S