【问题标题】:Incomplete svn commit histories with git svn使用 git svn 不完整的 svn 提交历史
【发布时间】:2019-09-12 20:37:18
【问题描述】:

我们正在将一个 svn 分支迁移到 git。

我们未能从 git repo 中的 svn 获取完整的提交历史记录,需要帮助才能正确获取完整的历史记录。

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

“警告:有太多无法访问的松散对象;运行 'git prune' 删除它们。”

我们的 repo 大约有 r250000 次提交

我们在 https://abc.xyz.com/svn/app1 有一个 repo 根 URL

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

tp

src

jrp

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

tp

src

jrp

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

我们使用非标准的 SVN 布局

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

我们不使用 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)

然后我们检查提交历史

svngitTrunkrepo2]# git log -v

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

【问题讨论】:

  • 您需要在 git 和 svn 之间来回迁移提交还是只是从 SVN 导出?我最近尝试了 git svn 也失败了。对于导出仅查看github.com/svn-all-fast-export/svn2git
  • 嗨加密西瓜;谢谢回复。我们需要在 git 和 svn 之间来回迁移提交。

标签: git git-svn


【解决方案1】:

消息

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 都会尝试启动。这很适合上面的fatal 消息。

尝试运行git svn 没有任何 gc.* 参数 - 我认为它们弊大于利。

【讨论】:

    猜你喜欢
    • 2021-09-30
    • 1970-01-01
    • 2019-01-30
    • 2018-06-08
    • 2020-09-03
    • 1970-01-01
    • 2020-12-01
    • 1970-01-01
    • 2010-09-29
    相关资源
    最近更新 更多