如何从复杂的颠覆存储库迁移到分布式版本控制系统?

发布于 2024-07-19 08:29:59 字数 500 浏览 7 评论 0原文

假设我们有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

奶茶白久 2024-07-26 08:29:59

Mercurial 附带了一个转换扩展,它应该可以满足您的需求。 请参阅 Mercurial 网站上的转换扩展程序详细信息。

Mercurial comes with a convert extension which should do what you want. See the convert extension details on the Mercurial web site.

假装爱人 2024-07-26 08:29:59

对于 Git,请参阅 http://github.com/guides/import-from-subversion 中的说明 。

上次我手动执行此操作时,我使用了以下命令 (这是针对不使用标签或分支的项目。使用 svn2git 可能会产生如果你有标签或分支,结果比 git-svn 更好。)

cat "mysvnusername = Me Myself <[email protected]>" >> authors.txt

svnserve --daemon --foreground --root <SVN-REPO-PARENT-DIR>
git svn clone --stdlayout --authors-file=authors.txt --no-metadata svn://localhost/<SVN-REPO-NAME>

# push to a public repo and clone from there, to get push/pull working easily
cd <SVN-REPO-NAME>
git remote add origin [email protected]:mygithubusername/<GIT-REPO-NAME>.git
git push origin master
cd ..
rm -rf <SVN-REPO-NAME>

git clone [email protected]:mygithubusername/<GIT-REPO-NAME>.git

但是由于你有一个非标准的 SVN 存储库布局,你需要指定 --trunk、--tags 和 --branches 参数而不是 --stdlayout git svn 克隆

为了表示存储库的整个继承历史,您可以尝试重新排序存储库,这样您将拥有标准的平面存储库布局,而不是非标准层次结构:

/branches/original-0.1
/branches/original-0.2
/branches/variantA-trunk
/branches/variantA-who-branch_for_xxx
/branches/variantA-she-branch_for_yyy
/branches/variantB-trunk
/branches/variantB-who-branch_for_zzz
...

这应该使导入工具更容易理解存储库。 然后,当它们被导入后,您可以在新存储库中更好地重新组织它们。

另外,我听说 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.)

cat "mysvnusername = Me Myself <[email protected]>" >> authors.txt

svnserve --daemon --foreground --root <SVN-REPO-PARENT-DIR>
git svn clone --stdlayout --authors-file=authors.txt --no-metadata svn://localhost/<SVN-REPO-NAME>

# push to a public repo and clone from there, to get push/pull working easily
cd <SVN-REPO-NAME>
git remote add origin [email protected]:mygithubusername/<GIT-REPO-NAME>.git
git push origin master
cd ..
rm -rf <SVN-REPO-NAME>

git clone [email protected]:mygithubusername/<GIT-REPO-NAME>.git

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:

/branches/original-0.1
/branches/original-0.2
/branches/variantA-trunk
/branches/variantA-who-branch_for_xxx
/branches/variantA-she-branch_for_yyy
/branches/variantB-trunk
/branches/variantB-who-branch_for_zzz
...

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.

梦里梦着梦中梦 2024-07-26 08:29:59

如果您认为 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

仅此而已 2024-07-26 08:29:59

$ 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文