弄了很久,想使用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模型仓库中的资源从一个地方移动到另一个地方的办法(很久才解决)的更多相关文章

  1. WPF中的资源简介、DynamicResource与StaticResource的区别(转)

    什么叫WPF的资源(Resource)?资源是保存在可执行文件中的一种不可执行数据.在WPF的资源中,几乎可以包含图像.字符串等所有的任意CLR对象,只要对象有一个默认的构造函数和独立的属性. 也就是 ...

  2. java 从jar包中读取资源文件

    在代码中读取一些资源文件(比如图片,音乐,文本等等),在集成环境(Eclipse)中运行的时候没有问题.但当打包成一个可执行的jar包(将资源文件一并打包)以后,这些资源文件找不到,如下代码: Jav ...

  3. (转)java 从jar包中读取资源文件

    (转)java 从jar包中读取资源文件 博客分类: java   源自:http://blog.csdn.net/b_h_l/article/details/7767829 在代码中读取一些资源文件 ...

  4. WPF中的资源简介、DynamicResource与StaticResource的区别

    原文:WPF中的资源简介.DynamicResource与StaticResource的区别 什么叫WPF的资源(Resource)?资源是保存在可执行文件中的一种不可执行数据.在WPF的资源中,几乎 ...

  5. 将svn的项目转移到另外一个仓库中

    前几天在做一个项目的时候,因为需要,需要将Server A 上SVN仓库 repos1中的项目pro1迁移到Server B 上的SVN仓库中,首先想到的是:通过复制,但是仔细一想,这样是不可能的:然 ...

  6. 克隆git仓库中的一个分支

    克隆git仓库中的某一个分支,可用如下命令: git clone -b <branch_name> <repo> 如:git clone -b hdcp_ree_tee_dev ...

  7. eclipse多个项目保存到gitee上一个仓库中

    自己练习创建到多个项目,想同步到gitee上一个仓库中. 1. 首先在gitee上创建项目springtest 2. 在eclipse默认项目存放到地方创建文件夹springtest,用来同步gite ...

  8. 将本地的一个新项目上传到GitHub上新建的仓库中去

    转载: 如何将本地的一个新项目上传到GitHub上新建的仓库中去 踩过的坑: 1.在git push时报错 error: RPC failed; curl 56 SSL read: error:000 ...

  9. 如何将现有 git 仓库中的子项目单独抽出来作为一个独立仓库并保留其提交历史

    很多时候,我们会遇到在一个git仓库下包含了很多小项目,但是随着有些项目的需求逐渐增大或则市场需求,我们需要将其抽离出来,作为一个单独的项目进行维护并开发. 但是,如果直接拷贝文件粘贴到新建的git ...

随机推荐

  1. MongoDB shell操作

    shell命令操作语法和JavaScript很类似,其实控制台底层的查询语句都是用JavaScript脚本完成操作的.使用shell 命令,需要启动mongo.exe. 常用shell命令如下: 1. ...

  2. 1.0.3-学习Opencv与MFC混合编程之---打开本地摄像头

    源代码:http://download.csdn.net/detail/nuptboyzhb/3961643 版本1.0.3新增内容 打开摄像头 Ø 新建菜单项,Learning OpenCV——&g ...

  3. 【ASP.NET Web API教程】2.3 与实体框架一起使用Web API

    原文:[ASP.NET Web API教程]2.3 与实体框架一起使用Web API 2.3 Using Web API with Entity Framework 2.3 与实体框架一起使用Web ...

  4. 基于visual Studio2013解决C语言竞赛题之1093连接链表

        题目 解决代码及点评 #include <stdio.h> #include <stdlib.h> #include <math.h> #i ...

  5. Swift - whose view is not in the window hierarchy 问题解决方法

    问题现象:想在页面初始化的时候,使用self.presentViewController方法弹出个告警提示框UIAlertController.但行后报了个如下告警,同时告警框也出不来. 1 2015 ...

  6. BUG: scheduling while atomic: events/0/4/总结

    对于Linux内核来说,Oops就意外着内核出了异常,此时会将产生异常时CPU的状态,出错的指令地址.数据地址及其他寄存器,函数调用的顺序甚至是栈里面的内容都打印出来,然后根据异常的严重程度来决定下一 ...

  7. HDOJ 2442 -bricks 状态压缩DP 一直TLE.打表过的..

    有5个砖块..加上一个空着不放..那么有6种状态..所以很明显的可以用6进制的状态DP... 不过这么做..我觉得我已经能优化的都优化了...还是超时..一看数据范围是100*6..打表先AC了.. ...

  8. PreferenceActivity使用示例

    MainActivity如下: package cn.testpreferenceactivity; import android.content.SharedPreferences; import ...

  9. ABP模块设计

    ABP模块设计 返回ABP系列 ABP是“ASP.NET Boilerplate Project (ASP.NET样板项目)”的简称. ASP.NET Boilerplate是一个用最佳实践和流行技术 ...

  10. jfinal常见问题

    2014年的时候,学过一段时间的JFinal,当时主要是了解这个框架,研究了下源码,看懂了部分.今天,2015年2月7日,弄了一下午的JFinal,把未来要上线的一个官网项目,迁移到了JFinal.下 ...