修复缺少分支点的远程git-svn分支的历史记录 [英] Fix history of a remote git-svn branch that is missing its branch point

查看:120
本文介绍了修复缺少分支点的远程git-svn分支的历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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'r2'r0r1r2的副本,出现在git中,但不出现在svn中.在svn中,只有一个r0提交.

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

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

如何让git认识到r3是从r2分支出来的,并取消了r2'r1'r0'?


为了获得额外的荣誉:是否有一种通用方法可以重写git的svn历史视图,而不会被git svn fetch等人吞噬?

解决方案

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

我使用git branch-filter --msg-filter在每次提交中更新git-svn-id标记,问题消失了. (当然,运行git gc从我的仓库中清除了所有多余的提交)

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?

解决方案

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)

这篇关于修复缺少分支点的远程git-svn分支的历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆