实际上我想将源代码提交到svn中。我需要添加新文件并将其提交到svn存储库并使用以下代码。代码工作正常但无法提交到SVN
String urls = "http://192.168.0.19/svn/cadgraf/Branch/Jobs";
final String url = urls+File.separator+l_users.getSelectedValue().toString()+File.separator+"Active";
System.out.println("svn url------>"+url);
final String destPath = "/home/dev702/Desktop/Jobs-test/Tempfiles";
SVNRepository repository = null;
setupLibrary();
try {
//initiate the reporitory from the url
repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
//create authentication data
ISVNAuthenticationManager authManager =
SVNWCUtil.createDefaultAuthenticationManager("xxxxxx", "xxxxxx");
repository.setAuthenticationManager(authManager);
//output some data to verify connection
System.out.println("Repository Root: " + repository.getRepositoryRoot(true));
System.out.println("Repository UUID: " + repository.getRepositoryUUID(true));
//need to identify latest revision
long latestRevision = repository.getLatestRevision();
System.out.println("Repository Latest Revision: " + latestRevision);
//create client manager and set authentication
SVNClientManager ourClientManager = SVNClientManager.newInstance();
ourClientManager.setAuthenticationManager(authManager);
//use SVNUpdateClient to do the export
SVNCommitClient commitClient = ourClientManager.getCommitClient();
commitClient.setIgnoreExternals(false);
commitClient.doCommit(new File[]{new File(destPath)}, false, "Commit message", null, null, false, false, SVNDepth.INFINITY);
SVNCommitClient client = new SVNCommitClient(authManager, null);
SVNCommitInfo info;
info = client.doCommit( new File[]{new File(destPath)}, false, "Commit message", null, null, false, false, SVNDepth.INFINITY);
} catch (SVNException e) {
e.printStackTrace();
} finally {
System.out.println("Done");
}
代码工作正常但它没有将文件提交到SVN。