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

查看:21
本文介绍了如何跨存储库迁移 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).

要做到这一点,您应该:

To do this, you should:

1) 使用 整个 存储库的内容title="svnadmin dump">svnadmin dump:

1) Dump the contents of the entire repository using 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.这是最困难的部分:假设存储库也包含二进制数据,在纯文本编辑器中打开转储文件很可能会损坏转储文件.我使用所谓的十六进制编辑器"有很好的经验,例如 免费十六进制编辑器 XVI32

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天全站免登陆