1

SVNKITを使用してSVNデータベースの最新のリビジョン番号を取得したい。ローカルリポジトリを更新してヘッドリビジョン番号を取得したくないので、SVNリポジトリに直接連絡して最新のリビジョン番号を取得したい。私を助けてください 。

4

3 に答える 3

8
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()); 
于 2012-06-27T09:57:39.993 に答える
2
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();
}
于 2012-06-27T10:33:30.790 に答える
0
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);
于 2012-06-27T10:00:58.520 に答える