无法使用svnkit将整个SVN存储库签出到本地计算机

时间:2015-06-05 15:33:53

标签: java svn svnkit svn-checkout

我正在尝试使用svnkit检出整个SVN存储库到本地目录,当我尝试SVNUpdateClient时更新ClClient = clientManger.getUpdateClient();总是返回null。 我正在使用svnkit这样做。

这是我的代码:

File wcFolder=new File("some directory path");
        ISVNOptions myOptions=SVNWCUtil.createDefaultOptions(true); 
         ISVNAuthenticationManager myAuthManager=SVNWCUtil.createDefaultAuthenticationManager("xyz","abc"); 
        SVNClientManager clientManger = SVNClientManager.newInstance(myOptions, myAuthManager);
        SVNUpdateClient updateClient = clientManger.getUpdateClient();
        updateClient.setIgnoreExternals(false); 
        updateClient.doCheckout(SVNURL.parseURIDecoded("some path to xyz/trunk"), wcFolder, SVNRevision.HEAD,SVNRevision.HEAD, SVNDepth.INFINITY, true);

1 个答案:

答案 0 :(得分:2)

我找到了检查SVN的正确方法,

SVNURL svnurl = SVNURL.parseURIDecoded(url);
SVNRepository repository = SVNRepositoryFactory.create(svnurl);
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(uname, password);
repository.setAuthenticationManager(authManager);
SVNClientManager ourClientManager = SVNClientManager.newInstance();
ourClientManager.setAuthenticationManager(authManager);
SVNUpdateClient updateClient = ourClientManager.getUpdateClient();
updateClient.setIgnoreExternals(true);

long latestRevision = repository.getLatestRevision();
if (updateClient.doCheckout(svnurl, destinationDir,
        SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.INFINITY,
                allowUnversionedObstructions) == latestRevision) {
    ourClientManager.dispose();
}