修复缺少分支点的远程git-svn分支的历史记录 [英] Fix history of a remote git-svn branch that is missing its branch point
问题描述
我正在使用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'
是r0
,r1
和r2
的副本,出现在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/repo
和http://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屋!