2012-06-27 5 views

답변

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

감사 – Anandhakrishnan

+0

FWIW @juergen 링크가 나를 위해 죽었어요. 그러나 나는 정확히 같은 코드를 발견했다. (http://subversion.1072662.n5.nabble.com/getting-a-directory-s-latest-revision-number-td1734.html). (별로 중요하지 않음) –

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