2

I'm using ant with svntask to update a repository before I build an application. At the end of the build, an email goes out with the results of the build. It would be very helpful to include the svn revision number and message in that email, so if the build breaks, we know which revision to review.

I am currently displaying only the revision number:

<status path="${main.site}" revisionProperty="sqlUpdateStatus.revision"/>

But I don't know how (or if there is a way) to get that revision's message (the message put in by the commiter). Do you guys know how to do that?

FoxyBOA
  • 5,788
  • 8
  • 48
  • 82
user166267
  • 51
  • 1
  • 7
  • any way to get the revision message using ant ? i tried using ant svntask, but not able to find any way to get revision message. – Jugi Nov 12 '15 at 13:15

6 Answers6

2

It's not exactly an answer to your question, but have you considered using a Continuous Integration (CI) tool, such as Hudson?

Hudson comes out of the box with SVN and ANT support and the ability to email errors when the build fails.

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
2

I don't think there's a built in way to get the commit message, but you can pull it manually out of svn with a command like this:

svnlook log -r X /path/to/repo

This will return the log message for the revision X for the repository at /path/to/repo. You could wrap this up in ant's exec task to preform it from ant...

+1 for Hudson - very simple to deploy and set up

rjohnston
  • 7,153
  • 8
  • 30
  • 37
1

Using executable:

<exec executable="svn" dir="." outputproperty="ant.comment">
     <arg line="propget --revprop svn:log -r${ant.revision}"/>
</exec>
<echo>The comment is: ${ant.comment}</echo>
Steven de Salas
  • 20,944
  • 9
  • 74
  • 82
1

use the following command

svn propget --revprop svn:log -r HEAD --username USERNAME svn://THE_URL
venergiac
  • 7,469
  • 2
  • 48
  • 70
1
<svn username="username" password="password">
 <log url="svn://url"/>
</svn>
FoxyBOA
  • 5,788
  • 8
  • 48
  • 82
  • and how do I capture the output? I searched for more info on the log command, but the only thing I could find was here: http://code.google.com/p/svntask/source/diff?spec=svn24&r=24&format=side&path=/trunk/src/com/googlecode/svntask/command/Log.java# . I tried to set the logPropety attribute and then use the variable, but it doesn't work. And if I just leave it as you put it there, it says [svn] started ... [svn] finished. Thanks! – user166267 Sep 06 '09 at 00:42
  • sorry FoxyBOA, still here? :) I will probably go with rjohnston's suggestion if I don't find this out. And while Hudson appears to be a good suggestion, I don't have time to implement it just now. Maybe for the future. – user166267 Sep 09 '09 at 18:27
  • use the destFile="changelog.txt" option – Vasile Surdu Mar 27 '15 at 14:52
1

I don't know of a good way to get this with svnant, but a nice way to get it from the command line is:

svn propget --revprop svn:log -r1234
wolfcastle
  • 5,850
  • 3
  • 33
  • 46