SVNKIT를 사용하여 SVN 데이터베이스의 최신 개정 번호를 얻고 싶습니다. 로컬 저장소를 업데이트하고 헤드 개정 번호를 얻고 싶지는 않습니다. SVN 저장소에 직접 연락하여 최신 개정 번호를 얻고 싶습니다. 도와주세요.svnkit : SVN DB에서 최신 개정 번호를 얻는 방법?
1
A
답변
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());
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);
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();
}
감사 – Anandhakrishnan
FWIW @juergen 링크가 나를 위해 죽었어요. 그러나 나는 정확히 같은 코드를 발견했다. (http://subversion.1072662.n5.nabble.com/getting-a-directory-s-latest-revision-number-td1734.html). (별로 중요하지 않음) –