zoukankan      html  css  js  c++  java
  • 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之类的意思。

  • 相关阅读:
    windows 临界区 InitializeCriticalSectionAndSpinCount以及InitializeCriticalSection的区别
    SRWLock 轻量级的读写锁
    QT 遍历获取Form上的控件
    mssql 查询作业执行情况,耗时 等
    C++ builder FMX 遍历窗口所有控件 并 动态消失
    delphi fmx 控件从天上掉下来
    Vue2入门必知必会
    人人开源&项目脚手架&微服务整合
    Spring Security应用到源码分析
    K8S系统学习笔记总览
  • 原文地址:https://www.cnblogs.com/wangjiyuan/p/3409809.html
Copyright © 2011-2022 走看看