将目录迁移到其他svn存储库 [英] Migrating a directory to a different svn repository

查看:81
本文介绍了将目录迁移到其他svn存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在svn存储库中有代码,称为存储库A.现在,我需要将内容移动到存储库B,但是对于其他项目,存储库B已经启用了一段时间.是否可以将特定目录从存储库A移动到存储库B,同时保留文件历史记录?通常,要将整个存储库迁移到新服务器,我会这样做:

I have code in an svn repository, call it repository A. Now say that I need to move the contents to repository B, but repository B has already been active for a while for other projects. Is it possible to move a particular directory from repository A to repository B, preserving the file history? Normally, to migrate an entire repository to a new server, I would do:

svnadmin dump -r 0:179 rep_a > rep_a.dump
svnadmin create rep_b
svnadmin load rep_b < rep_a.dump

但是,这会作用于整个存储库,并假设存储库B首先是空的(我认为).我当然可以导出有问题的目录,然后将其导入到存储库B中,但是我会丢失版本历史记录.

However, this acts on the whole repository and assumes repository B is empty to start with (I think). I can of course export the directory in question and import it into repository B, but I lose the version history.

是否有一种简单的方法可以将特定目录从A移到B而不丢失版本历史记录?

Is there an easy way to move a particular directory from A to B without losing the version history?

推荐答案

假设您要将rep_a的目录trunk/project复制到rep_b,则必须使用以下命令:

Let's say you want to copy directory trunk/project of rep_a into rep_b, you have to use this command:

svnadmin dump rep_a | svndumpfilter include trunk/project | svnadmin load rep_b

rep_a相关的修订版将添加到rep_b的历史记录中.

The revisions related to rep_a will be added to the history of rep_b.

请务必谨慎,然后进行备份.另外,如果您具有公用目录,可能会很棘手,那么您将不得不从转储中删除目录创建(以避免两次创建相同的目录).

Be careful with that and make a backup before, of course. Also, it can be tricky if you have common directories, then you will have to remove directory creations from the dump (to avoid creating the same directories twice).

这篇关于将目录迁移到其他svn存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆