修复缺少分支点的远程 git-svn 分支的历史记录

发布于 2024-12-09 21:38:52 字数 977 浏览 5 评论 0原文

我使用 git-svn 与远程 svn 存储库进行交互,该存储库遵循主干、标签和分支的传统布局。

svn 中有一个分支,git 错过了它的历史记录。我知道历史是:

r0--r1--r2---r4---r6 remotes/trunk
         \
           r3---r5-- remotes/BRANCH_NAME

但 git 似乎错过了分支点并认为历史是:

r0---r1---r2-----r4---r6 remotes/trunk

r0'--r1'--r2'--r3--r5--- remotes/BRANCH_NAME

其中 r0', r1', and r2'< /code> 是出现在 git 中但不出现在 svn 中的 r0r1r2 的副本。在 svn 中只有一次 r0 提交。

.git/svn/refs/remotes/BRANCH_NAME/unhandled.log.gz 中的第一个条目可能会为专家提供线索:

r3
  +dir_prop: . svn:mergeinfo /product/trunk/src_py:371-436%2C438-532

How do I get git to recognize that r3是从 r2 分支出来的,并取消了 r2'r1'r0'


额外加分:是否有一种通用方法可以重写 git 的 svn 历史记录视图,并且不会被 git svn fetch 等人破坏?

I'm using git-svn to interact with a remote svn repsitory that follows the traditional layout of trunk, tags, and branches.

There's a branch in svn that git has missed the history of. I know the history to be:

r0--r1--r2---r4---r6 remotes/trunk
         \
           r3---r5-- remotes/BRANCH_NAME

But git seems to have missed the branch point and thinks the history is:

r0---r1---r2-----r4---r6 remotes/trunk

r0'--r1'--r2'--r3--r5--- remotes/BRANCH_NAME

Where r0', r1', and r2' are copies of r0, r1, and r2 that appear in git, but not in svn. In svn there is exactly one r0 commit.

The first entry in .git/svn/refs/remotes/BRANCH_NAME/unhandled.log.gz may offer the experts a clue:

r3
  +dir_prop: . svn:mergeinfo /product/trunk/src_py:371-436%2C438-532

How do I get git to realise that r3 was branched from r2 and do away with r2', r1', and r0'?


For extra credit: Is there a general way to rewrite git's view of svn history, that won't get clobbered by git svn fetch et al?

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

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

发布评论

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

评论(2

梦毁影碎の 2024-12-16 21:38:52

结果是日志消息中的 git-svn-id URL 不同,从而改变了 SHA1。例如http://hostname/repohttp://hostname.org.ext/repo

我使用 gitbranch-filter --msg-filter 来更新每次提交中的 git-svn-id 标记,问题就消失了。 (当然,运行 git gc 来清除我的存储库中的所有冗余提交)

It turned out to be the git-svn-id URL in the log messages that was different, thus altering the SHA1. E.g. http://hostname/repo and http://hostname.org.ext/repo.

I used git branch-filter --msg-filter to update the git-svn-id marker in every commit and the problem went away. (And of course ran git gc to scrub all the redundant commits from my repo)

万劫不复 2024-12-16 21:38:52

我建议您使用 SmartGit 而不是 git-svn。它可以正确处理此类 SHA1 更改。

或者,如果您有权访问 SVN serevr,请安装 SubGit 到其中。 SubGit 将创建一个可供您使用的链接 Git 存储库。 SVN 和 Git 存储库将始终保持同步。所以你可以只使用 Git 界面。

I would recommend you to use SmartGit instead of git-svn. It handles such SHA1-changes correctly.

Or alternatively, if you have an access to the SVN serevr, install SubGit into it. SubGit will create a linked Git repository that you can work with. SVN and Git repositories will always be in sync. So you can use just Git interface.

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