使用 git-svn 重新启用镜像

发布于 2024-11-19 04:06:15 字数 374 浏览 1 评论 0原文

一段时间以来,我一直将 Subversion 存储库镜像到 Git 存储库。这一直运作良好。但是,由于虚拟服务器崩溃并且没有备份,我必须再次设置镜像。我需要跟踪的存储库有近 1200 个提交,并且包含大量文件(这是使用 Git 镜像的主要原因,因为签出存储库副本的速度要快得多)。

我现在需要做的是让我新克隆的 Git 镜像再次跟踪 Subversion 存储库。我在添加新的远程引用时没有遇到任何问题,但似乎无法弄清楚如何能够再次将 svn 提交拉入 Git 分支。

我似乎收到的一个错误是无法从工作树历史记录中确定上游 SVN 信息

如何在仅落后于 Subversion 存储库几次提交的现有 Git 分支上重新启用 Subversion 存储库的镜像?

For some time now I've been mirroring a Subversion repository to a Git repository. Which has always worked fine. However, due to a crash of a virtual server and not having a backup I've got to setup the mirror again. The repository I need to track is almost 1200 commits big and contains a lot of files (which is the main reason for the Git mirror, as it's so much faster to checkout a copy of the repo).

What I need to do now is make my freshly cloned Git mirror make track the Subversion repository again. I've got no problems adding the new remote ref but can't seem to figure out how to be able to pull svn commits into the Git branch again.

One error I seem to receive is Unable to determine upstream SVN information from working tree history.

How can I re-enable mirroring a Subversion repository on a existing Git branch that's only behind a couple commits from the Subversion repository?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

沫离伤花 2024-11-26 04:06:15

让它再次工作的最简单方法是从原始目录复制 .git/svn 目录,因为这是跟踪额外的 svn 元数据的地方(假设 git-svn 配置相同) 。

但是,由于您没有它,请尝试以下操作:

  1. git svn init http://hostname/svn/repository 与您之前使用过的任何其他参数(也许是 -s?)

  2. git checkout 来自 svn 的最新提交。

  3. 重新创建 git-svn ref:git update-ref refs/remotes/git-svn HEAD (或者如果您使用 -s ,这应该是 refs/remotes/trunk 代替)

  4. 获取最新版本自当前提交以来来自 svn:git svn fetch --parent。这应该为您的整个历史记录重建 git-svn 元数据。

The easiest way to get it to work again is to copy over the .git/svn directory from the original, as this is where extra svn metadata are tracked (assuming the git-svn config is the same).

However, since you don't have it try this:

  1. git svn init http://hostname/svn/repository with any other parameters you used before (maybe -s?)

  2. git checkout the latest commit from svn.

  3. Recreate the git-svn ref: git update-ref refs/remotes/git-svn HEAD (or if you used -s, this should be refs/remotes/trunk instead)

  4. Fetch the latest from svn since the current commit: git svn fetch --parent. This should rebuild git-svn metadata for your entire history.

埖埖迣鎅 2024-11-26 04:06:15

我在 http://trac.parrot.org/parrot/wiki/ 找到了另一种方法git-svn-教程

将 git-svn 元数据添加到 github 克隆

如果您想重新填充 SVN 元数据,可以快速完成
通过从 gihub 上获取 Leto 仓库的最新克隆并添加
这到你的 .git/config

[svn-remote "svn"]
        网址 = https://svn.parrot.org/parrot
        fetch = trunk:refs/remotes/trunk

然后运行此命令来查找“顶部提交”

 git show origin/upstream | 
 git show origin/upstream | 
 git show origin/upstream |头-n 1

并将该提交哈希放入文件 .git/refs/remotes/trunk 中
(显然将 has 替换为上述命令中的 has)

 echo c85aaa38b99cedb087e5f6fb69ce6d4a6ac57a0b > .git/refs/remotes/trunk

最后

<前><代码> git svn fetch

I found another method at http://trac.parrot.org/parrot/wiki/git-svn-tutorial:

Adding git-svn metadata to the github clone

If you want to re-populate the SVN metadata that can quickly be done
by taking your up-to-date clone of leto's repo off of gihub and adding
this to your .git/config

[svn-remote "svn"]
        url = https://svn.parrot.org/parrot
        fetch = trunk:refs/remotes/trunk

Then run this command to find the "top commit"

 git show origin/upstream | head -n 1

and put that commit hash into a file .git/refs/remotes/trunk
(obviously replace the has with the one from the above command)

 echo c85aaa38b99cedb087e5f6fb69ce6d4a6ac57a0b > .git/refs/remotes/trunk

and finally

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