使用git svn的不完整的svn提交历史记录 [英] Incomplete svn commit histories with git svn

查看:208
本文介绍了使用git svn的不完整的svn提交历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在将svn分支迁移到git.

We are migrating an svn branch to git.

我们无法从git repo中的svn获取完整的提交历史记录,因此需要帮助才能正确获取完整的历史记录.

We failed in getting a complete commit histories from svn in git repo and need help to get the complete history correctly.

git svn clone对我们不起作用,因为它一直失败

git svn clone didnt work for us because it keeps failing with

警告:有太多无法到达的松散对象;请运行'git prune'删除它们."

"warning: There are too many unreachable loose objects; run 'git prune' to remove them."

我们的回购大约有r250000次提交

Our repo has about r250000 commits

我们在 https://abc.xyz.com/svn/app1

我们有一个包含文件夹的分支A(URL: https://abc.xyz.com/svn/app1/proj1/A/trunk )

We have branch A containing folders (url: https://abc.xyz.com/svn/app1/proj1/A/trunk)

tp

src

jrp

我们创建了分支B(从r12000的分支A)包含文件夹(URL: https://abc.xyz.com/svn/app1/path/to/proj2/B/trunk )

We have branch B created (from Branch A at r12000) containing folders (url: https://abc.xyz.com/svn/app1/path/to/proj2/B/trunk)

tp

src

jrp

我们想将svn分支B迁移到git作为git的主干

We want to migrate svn branch B to git as our trunk in git

我们使用非标准的SVN布局

We use non-standard SVN layout

我们使用git-svn版本2.18.0(svn 1.7.14)

We use git-svn version 2.18.0 (svn 1.7.14)

我们不使用svn2git

We do not use svn2git

我们在做什么错了?

第一次运行

我们尝试了

cd svngitTrunkrepo
git config gc.pruneExpire now
git config gc.auto 1
git svn init  https://abc.xyz.com/svn/app1 -T path/to/proj2/B/trunk --prefix svn/ svngitTrunkrepo
git svn fetch

error: invalid object 100644 xxxyyyzzz111222333444555666 for 'src/to/file.java'
fatal: git-write-tree: error building trees
write-tree: command returned error: 128

第二次跑

我们尝试了

cd svngitTrunkrepo2
git config gc.pruneExpire now
git config gc.worktreePruneExpire now
git config gc.reflogExpire now
git config gc.reflogExpireUnreachable now
git config gc.auto 1
git svn init https://abc.xyz.com/svn/app1 -T path/to/proj2/B/trunk --prefix svn/ svngitTrunkrepo2
git svn fetch -r 1:50000
git gc --aggressive
git svn fetch -r 50000:66813
git gc --aggressive
git svn fetch -r 66813:76813
git gc --aggressive
(continue)
git svn fetch -r 216813:220000
git gc --aggressive

运行结果显示

(continue)
r218237 = b9e6e8ee272fdaa2611f6c3e9ccc05d412ecdf48 (refs/remotes/svn/trunk@218238)
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
Found branch parent: (refs/remotes/svn/trunk) b9e6e8ee272fdaa2611f6c3e9ccc05d412ecdf48
Following parent with do_switch
Successfully followed parent
r218239 = d4af17ac206cb4650f1aa0490dfdb4e1c00a5c16 (refs/remotes/svn/trunk)
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
Checking out files: 100% (63293/63293), done.
Checked out HEAD:
  https://abc.xyz.com/svn/app1/path/to/proj2/B/trunk r218239
fatal: gc is already running on machine 'ppplwxzdw' pid 21345 (use --force if not)

然后我们检查提交历史记录

We then check the commit history

svngitTrunkrepo2]# git log -v

但是我们只看到29个修订版本,而不是预期的198312版本

but we only saw 29 revisions as opposed to the expected 198312 revisions

推荐答案

消息

fatal: gc is already running on machine 'slc15zdw' pid 21345 (use --force if not)

表示 git gc 试图启动两次.同时,您对 git gc 进行了非常奇怪的设置-特别是 git config gc.auto 1 意味着对于每个松散的对象 git gc 将尝试开始.非常适合上述致命消息.

indicates that git gc is trying to start twice. At the same time you have quite strange settings for git gc -- especially git config gc.auto 1 means that for every loose object git gc will try to start. Which fits nicely to the above fatal message.

尝试在没有 gc.* 参数的情况下运行 git svn -我认为它们弊大于利.

Try running git svn without any of the gc.* parameters - I think they will do more harm than good.

这篇关于使用git svn的不完整的svn提交历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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