从 Subversion 迁移到 Git,其中存储库最初未使用标准布局
我尝试迁移最初未使用标准布局的 Subversion 存储库。我不知道如何迁移它。
例如。在 SVN Rev 1. - 700 中,布局是
[svn]/projectfile
[svn]/projectfile2
直到修订版 700 然后它更改为
[svn]/trunk/projectfile
[svn]/tags
[svn]/branches
How can I run the git svn init command?
现在,当我使用
git svn init -s <subversion_repository>
它时,它会显示目录中的所有内容,就像没有分支一样。 (与使用下面的命令相同)
svn checkout <subversion_repository_root>/
I am try to migrate a Subversion repository which was not initially using the standard layout. I cannot figure out how to migrate it.
For Example. In SVN Rev 1. - 700, the layout is
[svn]/projectfile
[svn]/projectfile2
Until the revision 700 then it change to
[svn]/trunk/projectfile
[svn]/tags
[svn]/branches
How can I run the git svn init command?
Right now when I use
git svn init -s <subversion_repository>
it will show everything in the directory like there are no branches. (same like use below command)
svn checkout <subversion_repository_root>/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于我手头没有 subversion 存储库来尝试此操作,因此我只能概述一种解决此问题的方法,该方法可能有效也可能不起作用:
git svn init svn://path/to/svn/repo
git svn fetch --revision 1:699
(或者无论您使用非标准布局的修订范围是什么).git/config
并修改[svn-remote]
添加/修改fetch
、branches
和tags
条目的部分:git svn fetch --revision 700:HEAD
获取其余部分 如果到目前为止一切理论上,这应该为您提供一个具有完整历史记录、所有分支和标签完好无损的 Git 存储库。
像往常一样,在执行任何此类操作之前,请对可能涉及到的任何内容进行备份,并自行承担风险等。
As I don't have a subversion repo at hand to try this out with, I can only outline a way of solving this which may or may not work:
cd
into itgit svn init svn://path/to/svn/repo
git svn fetch --revision 1:699
(Or whatever the revision range is where you used the non-standard layout).git/config
and modify the[svn-remote]
section to add/modify thefetch
,branches
andtags
entries:git svn fetch --revision 700:HEAD
to fetch the rest of the repogit svn rebase --local
to make sure Git creates the files.In theory, this should get you a Git repository with the complete history and all the branches and tags intact.
As usual, make backups of anything that might be touched by this before doing any of this stuff, and proceed at your own risk, etc.
正如所提供的答案,我发现当已经获取 Git 的所有修订版本时会出现问题。创建新问题,例如 在我查看了存储库
之后,我发现如果我提供参数(-s)将我的存储库标记为标准存储库,它将忽略所有非标准存储库,在我的情况下,它将忽略Rev。 1-700 和之后将自动从 700 转换。
所以,现在,我仍然没有解决方案,除了使用 git-svn 来从原始 url 中完整获取并忽略导致问题发生的路径。
As the answer provided, I found that there will be the problem when already fetch all revisions to Git. Create new issue like this topic
After I reviewed the repository, I found that if I provide the parameter (-s) to mark my repository as standard repository, it will ignore for all non-standard, in my case, it will ignore Rev.1-700 and will automatic convert from 700 afterward.
So, right now, I still have no solution except use git-svn with the full fetch from the original url and ignore the path that make the problem occurs.