将多个 SVN 存储库合二为一 [英] Combining multiple SVN repositories into one
问题描述
在考虑我上一个问题的答案后(一个 SVN 存储库还是多个?),我决定将我拥有的 4 个左右的存储库合并为一个.这当然会引出一个问题,这样做的最佳方法是什么?
After considering the answers to my previous question (One SVN Repository or many?), I've decided to take the 4 or so repositories I have and consolidate them into one. This of course leads to the question, what's the best way to do this?
有没有办法组合两个或多个存储库,同时维护两者的版本历史?
Is there a way to combine two or more repositories maintaining the version history for both?
我还应该指出我正在使用 Assembla.com,它不提供对 svnadmin 命令的访问权限,AFAIK
另一个这还重要吗?如果 svnadmin 对 URL 有效,那么就没有问题.
推荐答案
哦,问题编辑是在我打字时进行的.这是对
Oh well, the question edit was made while I was typing. This is an answer to
有没有办法组合两个或多个版本库维护两者的历史?
Is there a way to combine two or more repositories maintaining the version history for both?
<小时>
假设
现有存储库的结构如下:
The existing repositories have a structure like:
- 仓库根目录
- 分支机构
- 标签
- 后备箱
并且您想要一个类似于以下内容的结构:
and you want a structure something like:
- 仓库根目录
- 项目A
- 分支机构
- 标签
- 后备箱
- 分支机构
- 标签
- 后备箱
然后对于您的每个项目存储库:
Then for each of your project repositories:
svnadmin dump > project<n>.dmp
然后对于每个转储文件:
Then for each of the dump files:
svn mkdir "<repo url>/project<n>" svnadmin load --parent-dir "project<n>" <filesystem path to repos>
可以进行更复杂的操作,但这是最简单、最直接的.在转储/加载期间更改源存储库结构是危险的,但可以通过
svnadmin dump
、svndumpfilter
、手动编辑或附加文本过滤器和svnadmin 的组合来实现加载
More complex manipulations are possible, but this is the simplest, most straightforward. Changing the source repository structure during a dump/load is hazardous, but doable through a combination of
svnadmin dump
,svndumpfilter
, hand-editing or additional text filters andsvnadmin load
与第三方提供商打交道
- 为您的每个存储库请求
svnadmin dump
文件.提供者应该愿意/能够提供这一点——它是您的代码! - 在本地创建一个 SVN 存储库.
- 对转储文件执行上面列出的操作.
- 使用您最喜欢的客户端验证存储库结构是否正确.
- 为合并的存储库创建转储文件.
- 请求提供者从这个转储文件中填充一个新的存储库.
- Request
svnadmin dump
files for each of your repositories. The provider should be willing/able to provide this - it is your code! - Create an SVN repository locally.
- Perform the actions listed above for the dump files.
- Verify the repository structure is correct with your favorite client.
- Create a dump file for the combined repositories.
- Request that the provider populate a new repository from this dump file.
YMMV:这似乎是一个合理的方法,但我从未与这样的第三方提供商合作过.
YMMV: This seems to be a reasonable approach, but I've never worked with a third party provider like this.
这篇关于将多个 SVN 存储库合二为一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- 项目A