git - 使用快速导出将 mercurial repo 转换为 git 时至少出现一个未命名的头部错误

标签 git mercurial migrate

我正在尝试使用 fast-export 从 mercurial 存储库迁移到 git 存储库, 但我得到了

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

最佳答案

更新 以下代码由 ondrej-stanek-ozobot 增强,并于 2020 年 7 月 31 日 merge 到 fast-export 中。


原始答案

我写了一个plugin for fast-export这允许您为未命名的头部指定发散提交以及新分支名称,并且整行将移动到该新分支。

/path/to/hg-fast-export.sh -r /path/to/hg_repo -f --plugin head2branch=aliases,373 --plugin head2branch=threads,374

在(希望) merge 之前,使用此插件的步骤:

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

此时,研究每个未命名的 head 以找到它的第一个分歧提交,以及一个新的分支名称。例如:

$ /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 忽略未命名的磁头错误:

$ /path/to/fast-export/hg-fast-export.sh -r /path/to/hg-repo -f --plugin head2branch=aliases,373 --plugin head2branch=threads,374

关于git - 使用快速导出将 mercurial repo 转换为 git 时至少出现一个未命名的头部错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58862417/

相关文章:

ruby-on-rails - 如何在rails中迁移dbase数据库

mysql - Migrating MySQL UTF8 to UTF8MB4问题与疑问

相同工作目录的 git remotes 是不同的(或者至少看起来是这样)

git - VCS 上的 Elastic Beanstalk .config 文件?

混帐 pull "fatal: Uh oh. Your system reports no Git commands at all."

python - 没有名为 csv 的模块

git - 获取git中的所有分支并获取所有分支的Hashcode

mercurial - 考虑从WordPress迁移到Jekyll:何去何从?

svn - 如何在 SVN、Hg 或 Git 中标记一组更改/变更集

搜索:搜索选项从 MarkLogic 7 迁移到版本 8