import java.io.File;
import org.tmatesoft.svn.core.SVNCommitInfo;
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory;
import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions;
import org.tmatesoft.svn.core.wc.SVNClientManager;
public class SVNCommit {
private static String svnUrl = "https://XYZ";
private static String uName = "ABC";
private static String pwd = "PQR";
private static String filePath = "C:/Folder/Report.doc";
public static SVNCommitInfo sendToSVN(final String repoURL, final String sVNDir, final String uName, final String pwd, final String commitMessage) throws SVNException {
final SVNClientManager cm = SVNClientManager.newInstance(new DefaultSVNOptions(), uName, pwd);
return cm.getCommitClient().doImport(new File(sVNDir), SVNURL.parseURIEncoded(repoURL), "<import> " + commitMessage, null, false, true, SVNDepth.fromRecurse(true));
}
public static void main(String [] args) throws Exception {
try {
DAVRepositoryFactory.setup();
SVNRepositoryFactoryImpl.setup();
FSRepositoryFactory.setup();
sendToSVN(svnUrl, filePath, uName, pwd, "Report Added Successfully");} catch (Exception e) {
e.printStackTrace();
}
}
}
我想在SVN信息库的现有文件夹中发送文件。但是接收到E150002:路径'https://XYZ'已经存在
我正在尝试使用SVNCommitInfo类进行提交
正在接收以下日志...。
org.tmatesoft.svn.core.SVNException: svn: E150002: Path 'https://XYZ' already exists
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:70)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:57)
at org.tmatesoft.svn.core.internal.wc16.SVNCommitClient16.doImport(SVNCommitClient16.java:822)
at org.tmatesoft.svn.core.internal.wc2.old.SvnOldImport.run(SvnOldImport.java:26)
at org.tmatesoft.svn.core.internal.wc2.old.SvnOldImport.run(SvnOldImport.java:10)
at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:21)
at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1239)
at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:294)