I'd like to be able to read the current svn revision number (I'm using Subclipse) from my Java Code to output it with the rest of the things I need in my regression tests written using JUnit 4.
I googled a lot without any luck (some info pointing to javahl.jar, but I wasn't able to figure out anything useful for my case), I also tried to figure out by myself but no luck again.
Environment:
If possible I'd like to avoid to read .snv files directly and reach a "clean" solution because I have to leave this code to other people.
Thanks in advance, Alessandro
I figured out that the questions seems still open even if I solved the problem, I post here the code for clarity even if it was already inserted into a commet:
import org.tigris.subversion.javahl.*;
[...]
SVNClient svnClient = new SVNClient();
@SuppressWarnings("deprecation")
Status [] status = svnClient.status("absolutepathOfTheProject", true, false, true);
for(Status stat : status)
revNumber = (revNumber < stat.getRevisionNumber()) ? stat.getRevisionNumber() : revNumber;
Please note that this stub uses some deprecated methods, it is of course possible to replace them with other methods, but this is to be intended as a guideline for solving the original problem.