我需要使用svnkit jar在svn中创建一个文件夹。我尝试使用以下代码
String url = Config.svnurl + "/" + qcuser + "/" + "Completedjobs";
try {
SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(Config.svnusername, Config.svnuserpwd);
repository.setAuthenticationManager(authManager);
} catch (SVNException e) {
e.printStackTrace();
System.exit(1);
}
任何想法PLZ建议
答案 0 :(得分:2)
请尝试以下代码
SVNCommitClient commitClient = ourClientManager.getCommitClient();
commitClient.setIgnoreExternals(false);
SVNNodeKind nodeKind = null;
try {
nodeKind = repository.checkPath("", -1);
} catch (SVNException ex) {
Logger.getLogger(Reassignscreen.class.getName()).log(Level.SEVERE, null, ex);
}
if (nodeKind == SVNNodeKind.NONE) {
System.err.println("There is no entry at '" + url + "'.");
commitClient.doMkDir(new SVNURL[]{SVNURL.parseURIDecoded(url)}, "New Folder");
}
它可以使用它