at least one unnamed head error when converting mercurial repo to git using fast-export

☆樱花仙子☆ 提交于 2019-12-13 15:27:42

问题


I am attempting to migrate from a mercurial repository to a git repository using fast-export, but I am getting

Error: repository has at least one unnamed head: hg r491


回答1:


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

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


来源:https://stackoverflow.com/questions/58862417/at-least-one-unnamed-head-error-when-converting-mercurial-repo-to-git-using-fast

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!