弄了很久,想使用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. sqlserver05 字符串拆分

    -- 规则:将 gs-abc-aa-aa 拆分为一下字符 -- gs-abc-aa-aa -- gs-abc-aa -- gs-abc -- gs select * from dbo.f_split( ...

  2. 【开发手记一】老生常谈:简简单单配置ZED板开发环境

    说明:整理之前项目博客,此系列之前发表于与非网 http://www.openhw.org/module/forum/thread-552476-1-1.html 在拿到开发板和配套教材之前,我们小组 ...

  3. 关于CopyU!的常见问题解答

    拷优(CopyU!)常见问题解答 本常见问题解答列举了一些常见的疑问及其解释,如果您对CopyU!有任何问题,请您首先查看本解答! 本解答将会保持随时更新! 一.使用篇:     1.问:我的杀毒软件 ...

  4. C++学习之路—运算符重载(二)运算符重载作为类的成员函数和友元函数

    (根据<C++程序设计>(谭浩强)整理,整理者:华科小涛,@http://www.cnblogs.com/hust-ghtao转载请注明) 对运算符重载的函数有两种处理方式:(1)把运算符 ...

  5. Delphi线程池

    unit uThreadPool; {   aPool.AddRequest(TMyRequest.Create(RequestParam1, RequestParam2, ...)); } inte ...

  6. Mybatis 数据库物理分页插件 PageHelper

    以前使用ibatis/mybatis,都是自己手写sql语句进行物理分页,虽然稍微有点麻烦,但是都习惯了.最近试用了下mybatis的分页插件 PageHelper,感觉还不错吧.记录下其使用方法. ...

  7. uva 129

    暴力求解 大致题意 如果一个字符串含有相邻的重复字串称为容易的串,反之为非容易 求字典序第n困难的串…… 大致思路,暴力如果是容易的串停过,然后困难的串继续求解tot++ 总之先记着吧…… 最后输出格 ...

  8. jsp获得本地及serverIP的方法

    InetAddress addr = InetAddress.getLocalHost(); String ip = addr.getHostAddress().toString();//获得本机IP ...

  9. Windows环境下访问NFS(33篇Storage的文章)

    Windows环境下访问NFS 使用Solaris时,如果想在两台Solaris之间共享数据,那么你想到的最省事.最方便的方法肯定是nfs.但是现在的学生们的桌面,估计99%以上都是Windows,W ...

  10. CImage类

    CImage封装了DIB(设备无关位图)的功能,因而可以让我们能够处理每个位图像素.这里介绍GDI+和CImage的一般使用方法和技巧. TAG: GDI  CImage  后处理   我们知道,Vi ...