如何跨存储库迁移svn:externals属性中的所有URL? [英] How to migrate all URLs in svn:externals properties across a repository?

查看:162
本文介绍了如何跨存储库迁移svn:externals属性中的所有URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在将SVN信息库从一台机器迁移到另一台机器,随之而来的是新仓库的新域名.问题是,在资源库中,有很多svn:externals引用资源库中的其他项目.例如,我们有projectA,它在svn:externals属性中:

We are in the process of moving our SVN repositories from one machine to another one, and with it will come a new domain name for the new repo. The problem is, that within the repository, there are lots of svn:externals references to other projects within the repository. So for example, we have projectA, which has in the svn:externals properties:

external/libraryA svn://oldserver.net/repo/libraryA
external/libraryB svn://oldserver.net/repo/libraryB

...等等.所有URL都引用该特定域名,因此可以轻松地对其进行解析.学习完本课后,我将这些URL迁移为"svn://localhost/",但是我需要找到一种方法来浏览存储库历史记录并重写所有旧的URL,以便我们仍然可以检出这些项目的较旧版本,而没有断开的链接.

...and so on. All of the URL's reference this particular domain name, so it can be easily parsed. Having already learned my lesson, I will migrate these URLs to be "svn://localhost/", but I need to find a way to go through the repository history and rewrite all of the old URLs, so that we can still check out older revisions of these projects without having broken links.

我该怎么做?

推荐答案

正如您指出的那样,您仍然希望可以签出较旧的修订版,唯一的解决方案是真正重写"整个历史记录(前面提到的解决方案D ).

As you indicated that you still want to be able to check out older revisions, the only solution is really to "rewrite" the entire history (solution D mentioned earlier).

为此,您应该:

1)使用 svnadmin dump :

$ svnadmin dump /path/to/repos > original-dumpfile
* Dumped revision 0.
* Dumped revision 1.
* Dumped revision 2.
* Dumped revision 3.

2)编辑转储文件,以更改svn:externals URL. 这是最困难的部分:假设存储库中也包含二进制数据,那么在纯文本编辑器中打开转储文件很可能会损坏转储文件.我曾经使用过所谓的十六进制编辑器",例如

2) Edit the dump file, to change the svn:externals URLs. This is the most difficult part: Assuming the repository contains binary data as well, opening the dump file in a plain text editor will most likely corrupt the dump file. I've had good experiences using a so-called "hex-editor", for instance the Freeware Hex Editor XVI32

3)创建一个新的存储库,并将修改后的转储文件加载到其中:

3) Create a new repository and load the modified dumpfile into it:

$ svnadmin create newrepos
$ svnadmin load newrepos < modified-dumpfile

有关更多信息,您可能也对此链接感兴趣:
http://svnbook.red-bean.com/en/1.1/ch05s03.html

For more information, you might also be interested in this link:
http://svnbook.red-bean.com/en/1.1/ch05s03.html

注意:Subversion 1.5实际上在svn:externals属性中添加了对相对URL 的支持,这可以在将来精确地防止此类问题:
http://subversion.tigris.org/svn_1.5_releasenotes.html#externals

NOTE: Subversion 1.5 actually added support for relative URLs in the svn:externals property, which can precisely prevent these sort of problems in the future:
http://subversion.tigris.org/svn_1.5_releasenotes.html#externals

这篇关于如何跨存储库迁移svn:externals属性中的所有URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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