问题描述
我正在尝试使用 fast-export
从Mercurial存储库迁移到git存储库,但我得到了
I am attempting to migrate from a mercurial repository to a git repository using fast-export
, but I am getting
推荐答案
我写了一个插件fast-export
允许您为未命名的头部指定不同的提交以及新的分支名称,并且整行将移动到该新分支.
I wrote a plugin for fast-export
that allows you to specify the divergent commit for an unnamed head along with a new branch name, and that entire line will be moved to that new branch.
/path/to/hg-fast-export.sh -r /path/to/hg_repo -f --plugin head2branch=aliases,373 --plugin head2branch=threads,374
在(希望)合并之前,使用此插件需要采取的步骤:
Until this is (hopefully) merged, the steps to take to use this plugin:
git clone https://github.com/ethanfurman/fast-export.git
cd fast-export
git checkout head2branch-plugin
mkdir /path/to/new-git-repo
cd /path/to/new-git-repo
git init
/path/to/fast-export/hg-fast-export.sh -r /path/to/hg_repo
在这一点上,研究每个未命名的头部以找到其第一个不同的提交,以及一个新的分支名称.例如:
At this point, research each unnamed head to find its first divergent commit, and a new branch name for it. For example:
$ /path/to/fast-export/hg-fast-export.sh -r ~/path/to/hg-repo
Error: repository has unnamed head: hg r491
Error: repository has unnamed head: hg r373
最后,在插件处于活动状态的情况下运行fast-export
,指定-f
忽略未命名的头部错误:
Finally, run fast-export
with the plugin active, specifying -f
to ignore the unnamed heads error:
$ /path/to/fast-export/hg-fast-export.sh -r /path/to/hg-repo -f --plugin head2branch=aliases,373 --plugin head2branch=threads,374
这篇关于使用快速导出将Merurial存储库转换为git时至少出现一个未命名的头部错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!