tags:

views:

126

answers:

1

I would like to implement a method that can get the svn revision number from the path where a SVN repository has been checked out. The method declaration would look something like this:

long getRevisionNumber(String localPath) { ... }

I'm trying to use SVNKit for this, but it seems to require an SVN URL to start with. Is there any way to start with a local path?

+3  A: 
public static long getRevisionNumber(String localPath) throws SVNException {
    final SVNStatus status = SVNClientManager.newInstance().getStatusClient().doStatus(new File(localPath), false);
    return status != null ? status.getRevision().getNumber() : -1;
}
Marc Strapetz