如何将hg项目插入到git项目中?

时间:2016-05-02 12:37:30

标签: git mercurial

我知道this post。我尝试这样做,将mercurial项目(即eigen project)插入到给定的git项目中。

当我尝试克隆它时,我会得到像

这样的东西
Initialized empty Git repository in /tmp/.../.git/
Fordere alle ?nderungen an
F?ge ?nderungss?tze hinzu
F?ge Manifeste hinzu
F?ge Datei?nderungen hinzu
F?gte 8820 ?nderungss?tze mit 28623 ?nderungen an 2757 Dateien hinzu (+4 K?pfe)
Initialized empty Git repository in /tmp/multikopter/foo/.git/hgremote/
Error: repository has at least one unnamed head: hg r8485
git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects:       5000
Total objects:            0 (         0 duplicates                  )
  blobs  :            0 (         0 duplicates          0 deltas of          0 attempts)
  trees  :            0 (         0 duplicates          0 deltas of          0 attempts)
  commits:            0 (         0 duplicates          0 deltas of          0 attempts)
  tags   :            0 (         0 duplicates          0 deltas of          0 attempts)
Total branches:           0 (         0 loads     )
  marks:           1024 (         0 unique    )
  atoms:              0
Memory total:          2282 KiB
   pools:          2048 KiB
 objects:           234 KiB
---------------------------------------------------------------------
pack_report: getpagesize()            =       4096
pack_report: core.packedGitWindowSize = 1073741824
pack_report: core.packedGitLimit      = 8589934592
pack_report: pack_used_ctr            =          0
pack_report: pack_mmap_calls          =          0
pack_report: pack_open_windows        =          0 /          0
pack_report: pack_mapped              =          0 /          0
---------------------------------------------------------------------

fatal: Couldn't find remote ref HEAD
fatal: The remote end hung up unexpectedly

使用标志--force时,这会产生巨大的输出,并且至少会根据需要在git中创建一些提交。但是,该过程终止于输出

Traceback (most recent call last):
  File "/usr/share/hg-fast-export/hg-fast-export.py", line 387, in <module>
    options.statusfile,authors=a,sob=options.sob,force=options.force))
  File "/usr/share/hg-fast-export/hg-fast-export.py", line 298, in hg2git
    ui,repo=setup_repo(repourl)
  File "/usr/share/hg-fast-export/hg2git.py", line 34, in setup_repo
return myui,hg.repository(myui,url)
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 112, in repository
    peer = _peerorrepo(ui, path, create)
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 102, in _peerorrepo
    obj = _peerlookup(path).instance(ui, path, create)
  File "/usr/lib/python2.7/dist-packages/mercurial/localrepo.py", line 2478, in instance
    return localrepository(ui, util.urllocalpath(path), create)
  File "/usr/lib/python2.7/dist-packages/mercurial/localrepo.py", line 217, in __init__
    raise error.RepoError(_("repository %s not found") % path)
mercurial.error.RepoError: Projektarchiv  nicht gefunden

最后一个文字表示德语中的repository not found

如果我尝试git hg fetchgit hg pull,我会得到完全相同的追溯。此外,似乎并非eigen library的所有提交都是刚刚创建的git存储库的一部分。将git中master的最新提交与mercurial中的最新提交进行比较时,会发现超过一年的工作(至少对我而言)。

有人可以验证吗?

我该如何克服这个问题? (主要项目的GIT已设置。问题是如何将库集成到匹配版本中。)

如果可能有帮助,有人可以告诉我git-hg的替代方案吗?

1 个答案:

答案 0 :(得分:0)

主要(现在)问题

  

错误:存储库至少有一个未命名的头:hg r8485

Mercurial在命名分支中可以有多个头,Git分支是丑陋和弱的,Git无法处理这种情况。也就是说,r8485是default分支的封闭头(但是只在某些区域才有意义,而且仅适用于Mercurial)

>hg log -r "heads(branch(default))"
changeset:   8485:59a7e404a93c
parent:      8483:df620f192518
user:        Christoph Hertzberg <chtz@informatik.uni-bremen.de>
date:        Thu Mar 17 19:38:45 2016 +0100
summary:     closing wrong default

changeset:   8820:1249b66e1544
tag:         tip
user:        Benoit Steiner <benoit.steiner.goog@gmail.com>
date:        Mon May 02 19:50:22 2016 -0700
summary:     Made a cast explicit

可能的解决方案(需要使用Mercurial)

  • Dummy-merge 8485 into current tip
  • 原始仓库的部分克隆,其中排除(所有)叶节点