如何从复杂的颠覆存储库迁移到分布式版本控制系统?
假设我们有一个 subversion 存储库,看起来像
/original/0.1
/original/0.2
/variantA/trunk
/variantA/branches/who/branch_for_xxx
/variantA/branches/she/branch_for_yyy
/variantB/trunk
/variantB/branches/who/branch_for_zzz
(... 30 or 40 alike)
variantA 和variantB 是原始软件的分支。
我正在寻找一种将此存储库迁移到分布式版本控制系统的方法:这种方法
- 不一定需要
- 为任何一个众所周知的分布式版本控制系统
- 使用单个命令,从而使 dvcs 认为它们是分支:/official/{0.1, 0.2} 树,/variantA/trunk 树,...
- 使 dvcs 知道这些树的继承关系
Let's suppose we have a subversion repository which looks like
/original/0.1
/original/0.2
/variantA/trunk
/variantA/branches/who/branch_for_xxx
/variantA/branches/she/branch_for_yyy
/variantB/trunk
/variantB/branches/who/branch_for_zzz
(... 30 or 40 alike)
where variantA and variantB are forks of the original software.
I am looking for a method for migrating this repository into a distributed version control system: a method
- not necessarily wigh a single command
- for any one of well-known distributed version control systems
- making the dvcs think of them branches: /official/{0.1,0.2} trees, /variantA/trunk tree, ...
- making the dvcs aware of the inheritance relation of those trees
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Mercurial 附带了一个转换扩展,它应该可以满足您的需求。 请参阅 Mercurial 网站上的转换扩展程序详细信息。
Mercurial comes with a convert extension which should do what you want. See the convert extension details on the Mercurial web site.
对于 Git,请参阅 http://github.com/guides/import-from-subversion 中的说明 。
上次我手动执行此操作时,我使用了以下命令 (这是针对不使用标签或分支的项目。使用 svn2git 可能会产生如果你有标签或分支,结果比 git-svn 更好。)
但是由于你有一个非标准的 SVN 存储库布局,你需要指定 --trunk、--tags 和 --branches 参数而不是 --stdlayout git svn 克隆。
为了表示存储库的整个继承历史,您可以尝试重新排序存储库,这样您将拥有标准的平面存储库布局,而不是非标准层次结构:
这应该使导入工具更容易理解存储库。 然后,当它们被导入后,您可以在新存储库中更好地重新组织它们。
另外,我听说 Git 1.6.x 支持深度克隆,因此您可以向 git svn clone 提供参数,例如
--branches=branches/*/*
这将深入查看分支的层次结构。 有关示例,请参阅这篇文章使用它。For Git, see the instructions at http://github.com/guides/import-from-subversion
The last time that I did it manually, I used the commands below. (This was for a project which did not use tags or branches. Using svn2git might produce better results than git-svn if you have tags or branches.)
But since you have a non-standard SVN repository layout, you will need to specify the --trunk, --tags and --branches parameters instead of --stdlayout for git svn clone.
To represent the whole inheritance history of your repository, you could try reordering your repository so that instead of a non-standard hierarchy you would have a standard flat repository layout:
That should make it easier for import tools to understand the repository. Then when they have been imported, you can reorganize them better inside the new repository.
Also, I've heard that Git 1.6.x supports deep cloning, so that you can give to
git svn clone
parameters such as--branches=branches/*/*
which will look deep into the hierarchy for branches. See this post for an example of using it.如果您认为 Git 作为可能的 DVCS 候选者,则 ruby 脚本 svn2git 可以满足您的需求。
问题中的更多详细信息:克隆使用 Git-Svn 的非标准 Svn 存储库
If you consider Git as a possible DVCS candidate, the ruby script svn2git does what you need.
More details in the question: Cloning a Non-Standard Svn Repository with Git-Svn
$ bzr svn-import --layout trunk1 svn-root-url bzr.repo
应该做正确的事情。 您需要安装 bzr-svn 插件才能执行此操作。
$ bzr svn-import --layout trunk1 svn-root-url bzr.repo
Should do the right thing. You need to have the bzr-svn plugin installed in order to be able to do this.