簡體   English   中英

svnkit:如何從SVN DB獲取最新版本號?

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

我想使用SVNKIT獲取SVN數據庫的最新修訂版本號。 我不想更新本地存儲庫並獲取總修訂版號,我想直接聯系SVN存儲庫並獲取最新的修訂版號。 請幫我 。

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()); 
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();
}
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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM