SVNKIT的SVNCommitClient的doMkDir的操作
package com.repositoryclient.svnoptions;
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.svn.SVNRepositoryFactoryImpl;
import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions;
import org.tmatesoft.svn.core.wc.ISVNOptions;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNCommitClient;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
public class ModelDeveloperUpLoadOption{
public boolean doUpLoad(String userName,String passwd,String SVNServerUrl,String dirPath,String folderName){
SVNClientManager ourClientManager;
// 初始化支持svn://协议的库
SVNRepositoryFactoryImpl.setup();
// 相关变量赋值
SVNURL repositoryUrl = null;
SVNURL uploadFolderUrl=null;
SVNURL[] folder=new SVNURL[1];
try {
repositoryUrl = SVNURL.parseURIEncoded(SVNServerUrl);
uploadFolderUrl=SVNURL.parseURIEncoded(SVNServerUrl+folderName);
ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
// 实例化客户端管理类
ourClientManager = SVNClientManager.newInstance(
(DefaultSVNOptions) options, userName, passwd);
// 要把此目录的内容导入到版本库
File impDir = new File(dirPath);
// 执行导入操作
SVNCommitClient svnCommitClient = ourClientManager.getCommitClient();
folder[0]=uploadFolderUrl;
svnCommitClient.doMkDir(folder, folderName);
SVNCommitInfo commitInfo = svnCommitClient.doImport(impDir,
uploadFolderUrl, "import operation!", null, true, true,
SVNDepth.INFINITY);
//System.out.println(commitInfo.toString());
return true;
} catch (SVNException e) {
// TODO: handle exception
e.printStackTrace();
return false;
}
}
}注意,这个函数的第一个参数要包含新建的文件夹的名称,就是说给出的url一定是一个新的url。第二个参数可能是message之类的意思。
相关推荐
Lzs 2020-10-23
聚合室 2020-11-16
零 2020-09-18
Justhavefun 2020-10-22
ChaITSimpleLove 2020-10-06
周游列国之仕子 2020-09-15
afanti 2020-09-16
88234852 2020-09-15
YClimb 2020-09-15
风雨断肠人 2020-09-04
卖口粥湛蓝的天空 2020-09-15
stulen 2020-09-15
pythonxuexi 2020-09-06
abfdada 2020-08-26
梦的天空 2020-08-25