从 Subversion 迁移到 Git,其中存储库最初未使用标准布局

发布于 2024-12-16 23:36:27 字数 506 浏览 3 评论 0原文

我尝试迁移最初未使用标准布局的 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 技术交流群。

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

发布评论

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

评论(2

烂人 2024-12-23 23:36:27

由于我手头没有 subversion 存储库来尝试此操作,因此我只能概述一种解决此问题的方法,该方法可能有效也可能不起作用:

  • 首先,创建一个目录来保存您的 Git 存储库和 cd 初始化
  • 您的 Git 存储库: git svn init svn://path/to/svn/repo
  • 在此存储库中,运行 git svn fetch --revision 1:699 (或者无论您使用非标准布局的修订范围是什么)
  • 修改 .git/config 并修改 [svn-remote]添加/修改 fetchbranchestags 条目的部分:
  [svn-remote "svn"]
    url = svn://path/to/svn/repo
    fetch = trunk:refs/remotes/trunk
    branches = branches/*:refs/remotes/*
    tags = tags/*:refs/remotes/tags/*
  • 运行 git svn fetch --revision 700:HEAD 获取其余部分 如果到目前为止一切
  • 正常,但您的工作目录中没有任何文件,请运行 git svn rebase --local 来确保 Git 创建文件。

理论上,这应该为您提供一个具有完整历史记录、所有分支和标签完好无损的 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:

  • First, make a directory to hold your Git repo and cd into it
  • Initialize your Git repo: git svn init svn://path/to/svn/repo
  • Inside this repo, run git svn fetch --revision 1:699 (Or whatever the revision range is where you used the non-standard layout)
  • Modify .git/config and modify the [svn-remote] section to add/modify the fetch, branches and tags entries:
  [svn-remote "svn"]
    url = svn://path/to/svn/repo
    fetch = trunk:refs/remotes/trunk
    branches = branches/*:refs/remotes/*
    tags = tags/*:refs/remotes/tags/*
  • Run git svn fetch --revision 700:HEAD to fetch the rest of the repo
  • If everything worked until this point, but you don't have any files in your working directory, run git 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.

碍人泪离人颜 2024-12-23 23:36:27

正如所提供的答案,我发现当已经获取 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.

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