SVN模型仓库中的资源从一个地方移动到另一个地方的办法(很久才解决)
弄了很久,想使用domove这个操作,但是都失败了。最后给svnkit的邮箱写了封邮件,他们告诉我这样做就成功了。实际上是使用docopy这个函数实现了move操作。
package com.repositoryclient.svnoptions; import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
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.io.SVNRepository;
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import org.tmatesoft.svn.core.wc.ISVNOptions;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNCopyClient;
import org.tmatesoft.svn.core.wc.SVNCopySource;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNWCUtil; public class StoreManagerCheckResourceOption { private SVNRepository repositoryTrgt;
private SVNRepository repositorySrc; public boolean doMove(String userName,String passwd,String sourceDirUrl,String targetDirUrl){
SVNClientManager ourClientManager;
// 初始化支持svn://协议的库
SVNRepositoryFactoryImpl.setup();
DAVRepositoryFactory.setup();
FSRepositoryFactory.setup();
SVNURL repositorySrcUrl = null;
SVNURL repositoryTrgtUrl = null; try {
SVNWCUtil.createDefaultAuthenticationManager(userName,passwd);
repositorySrcUrl = SVNURL.parseURIEncoded(sourceDirUrl);
repositoryTrgtUrl = SVNURL.parseURIEncoded(targetDirUrl);
repositorySrc = SVNRepositoryFactory.create(repositorySrcUrl);
repositoryTrgt = SVNRepositoryFactory.create(repositoryTrgtUrl);
ISVNAuthenticationManager authManager =SVNWCUtil.createDefaultAuthenticationManager(userName,passwd);
repositorySrc.setAuthenticationManager(authManager);
repositoryTrgt.setAuthenticationManager(authManager);
ISVNOptions options = SVNWCUtil.createDefaultOptions(false);
// 实例化客户端管理类
ourClientManager = SVNClientManager.newInstance(
(DefaultSVNOptions) options, userName, passwd);
SVNCopyClient copyClient = ourClientManager.getCopyClient();
SVNCopySource[] copySources = new SVNCopySource[];
copySources[] = new SVNCopySource(SVNRevision.HEAD, SVNRevision.HEAD, repositorySrcUrl); // SVNDirEntry entry = (SVNDirEntry) srcRepository.getDir(sourceDirUrl, -1, null, (Collection) null);
// if (entry.getKind() == SVNNodeKind.DIR) {
// copyClient.doCopy(copySources, repositoryTrgtUrl, true, false, false, "move", null);
// } else {
// copyClient.doCopy(copySources, repositoryTrgtUrl, true, false, true, "move", null);
// }
copyClient.doCopy(copySources, repositoryTrgtUrl, true, false, false, "move", null);
// SVNWCClient client = new SVNWCClient(authenticationManager, (ISVNOptions)(SVNWCUtil.createDefaultOptions(true)));
// SVNCommitInfo svnInfo = ourClientManager.getLogClient(). // 要把此目录的内容导入到版本库
// File sourceDir = new File(sourceDirUrl); // File targetDir = new File("relative/" + targetDirUrl);
// targetDir = targetDir.getAbsoluteFile();
// sourceDir.setReadable(true);
// targetDir.setWritable(true);
// 执行导入操作
// SVNMoveClient svnMoveClient = ourClientManager.getMoveClient();
// SVNUpdateClient svnUpdateClient = new SVNUpdateClient(authenticationManager, options);
// svnMoveClient.doVirtualCopy(sourceDir, targetDir, true);
// svnMoveClient.doMove(sourceDir, targetDir);
// svnUpdateClient.doRelocate(sourceDir, repositorySrcUrl, repositoryTrgtUrl, true);
return true;
} catch (SVNException e) {
// TODO: handle exception
e.printStackTrace();
return false;
}
}
}
SVN模型仓库中的资源从一个地方移动到另一个地方的办法(很久才解决)的更多相关文章
- WPF中的资源简介、DynamicResource与StaticResource的区别(转)
什么叫WPF的资源(Resource)?资源是保存在可执行文件中的一种不可执行数据.在WPF的资源中,几乎可以包含图像.字符串等所有的任意CLR对象,只要对象有一个默认的构造函数和独立的属性. 也就是 ...
- java 从jar包中读取资源文件
在代码中读取一些资源文件(比如图片,音乐,文本等等),在集成环境(Eclipse)中运行的时候没有问题.但当打包成一个可执行的jar包(将资源文件一并打包)以后,这些资源文件找不到,如下代码: Jav ...
- (转)java 从jar包中读取资源文件
(转)java 从jar包中读取资源文件 博客分类: java 源自:http://blog.csdn.net/b_h_l/article/details/7767829 在代码中读取一些资源文件 ...
- WPF中的资源简介、DynamicResource与StaticResource的区别
原文:WPF中的资源简介.DynamicResource与StaticResource的区别 什么叫WPF的资源(Resource)?资源是保存在可执行文件中的一种不可执行数据.在WPF的资源中,几乎 ...
- 将svn的项目转移到另外一个仓库中
前几天在做一个项目的时候,因为需要,需要将Server A 上SVN仓库 repos1中的项目pro1迁移到Server B 上的SVN仓库中,首先想到的是:通过复制,但是仔细一想,这样是不可能的:然 ...
- 克隆git仓库中的一个分支
克隆git仓库中的某一个分支,可用如下命令: git clone -b <branch_name> <repo> 如:git clone -b hdcp_ree_tee_dev ...
- eclipse多个项目保存到gitee上一个仓库中
自己练习创建到多个项目,想同步到gitee上一个仓库中. 1. 首先在gitee上创建项目springtest 2. 在eclipse默认项目存放到地方创建文件夹springtest,用来同步gite ...
- 将本地的一个新项目上传到GitHub上新建的仓库中去
转载: 如何将本地的一个新项目上传到GitHub上新建的仓库中去 踩过的坑: 1.在git push时报错 error: RPC failed; curl 56 SSL read: error:000 ...
- 如何将现有 git 仓库中的子项目单独抽出来作为一个独立仓库并保留其提交历史
很多时候,我们会遇到在一个git仓库下包含了很多小项目,但是随着有些项目的需求逐渐增大或则市场需求,我们需要将其抽离出来,作为一个单独的项目进行维护并开发. 但是,如果直接拷贝文件粘贴到新建的git ...
随机推荐
- winform基础——实现简易赈灾物资发放登记系统
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...
- Spring mvc interceptor配置拦截器,没有登录跳到登录页
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- RapidCRC : Home
RapidCRC : Home What is RapidCRC? RapidCRC is a tool for windows for checking and creating CRC32 a ...
- 不使用webview,用手机浏览器的android app
需求:wap站在手机上以App的形式打开,但不要嵌套WebView,只能以浏览器打开 package com.gzz.whyinzi; import android.net.Uri; import a ...
- Computational Geometry Template
顿时觉得神清气爽!! #include <iostream> #include <math.h> #define eps 1e-8 #define zero(x) (((x)& ...
- myBatis 基础测试 表关联关系配置 集合 测试
myBatis 基础测试 表关联关系配置 集合 测试 测试myelipse项目源码 sql 下载 http://download.csdn.net/detail/liangrui1988/599388 ...
- OleContainer操作Excel以二进制方式读写数据库
需求源头:OleContainer操作Excel,想把Excel以二进制方式存入数据库,并且以二进制方式读取存入流:Procedure SaveToStream(ADOTable1: TAdoTabl ...
- 14.4.3.6 Fine-tuning InnoDB Buffer Pool Flushing 微调 InnoDB Buffer Pool 刷新:
14.4.3.6 Fine-tuning InnoDB Buffer Pool Flushing 微调 InnoDB Buffer Pool 刷新: innodb_flush_neighbors an ...
- COCOS2D中对精灵的操作、对图片的各种操作
内容简要: 1.初始化 2.创建无图的精灵 3.设置精灵贴图大小 4.添加入层中 5.对精灵进行缩放 6.对精灵宽或高进行缩放 7.旋转精灵 8.设置精灵透明度 9.精灵的镜像反转 10.设 ...
- C#整理
输入输出--数据类型--变量与常量--运算符表达式--语句(顺序.分支.循环)--数组--函数--结构体一.输入与输出.Console.ReadLine();Console.WriteLine();C ...