Search code examples
javasvnkit

svnkit: how to get latest revision number from SVN DB?


I want to get the latest revision number of the SVN database using SVNKIT. I don't want to update the local repository and get the head revision number , i want to directly contact the SVN repository and get the latest revision number. please help me .


Solution

  • DAVRepositoryFactory.setup();
    String url = "(directory in svn url)";
    String name = "(login name)";
    String password = "(login password)";
    SVNRepository repository = null;
    repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
    ISVNAuthenticationManager authManager =
                       SVNWCUtil.createDefaultAuthenticationManager(name, password);
    repository.setAuthenticationManager(authManager);
    SVNDirEntry entry = repository.info(".", -1);
    System.out.println("Latest Rev: " + entry.getRevision());