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

后端 未结 3 785
孤独总比滥情好
孤独总比滥情好 2020-12-20 07:14

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

相关标签:
3条回答
  • 2020-12-20 07:59
    FSRepositoryFactory.setup();
    File pathToRepository = new File("/path/to/repository");
    SVNRepository svnRepository = SVNRepositoryFactory.create(SVNURL.fromFile(pathToRepository));
    try {
        final long latestRevision = svnRepository.getLatestRevision();
        System.out.println("latestRevision = " + latestRevision);
    } finally {
        svnRepository.closeSession();
    }
    
    0 讨论(0)
  • 2020-12-20 07:59
    DAVRepositoryFactory.setup();
    
    final SVNURL url = SVNURL.parseURIDecoded("http://svn.apache.org/repos/asf");
    final SVNRepository repository = SVNRepositoryFactory.create(url);
    final long latestRevision = repository.getLatestRevision();
    System.out.println(latestRevision);
    
    0 讨论(0)
  • 2020-12-20 08:09
    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()); 
    
    0 讨论(0)
提交回复
热议问题