将带有子存储库的Mercury存储库迁移到git并保存历史记录的最佳方法? [英] Best way to migrate mercurial repo with subrepositories to git, preserving history?

查看:127
本文介绍了将带有子存储库的Mercury存储库迁移到git并保存历史记录的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Mercurial存储库迁移到git,但是问题是该Mercurial存储库有子存储库(有些带有分支),并且本身有很多合并和分支.我希望最终的git存储库保留所有这些历史记录,并在检出存储库或其他分支的较早部分时保持正确和完整.我不需要新的存储库来拥有子模块或子树,尽管我也接受使用该子模块或子树的解决方案.我见过的一些方法将新存储库顶部的所有子存储库合并为分支,这意味着过去的签出并不包含子存储库中的所有文件.我也尝试过将所有内容导入为分支,将头部重新设置为过去,合并和向上调整,但是合并太多,即使使用--preserve-merges,也会发生许多冲突,因此,我宁愿避免这种情况.我也找不到将git中的Mercurial子存储库更新历史记录复制为子模块更新历史记录的任何方法.有人有什么想法吗?谢谢.

I'm trying to migrate a mercurial repository to git, but the problem is that the mercurial repository has subrepositories (some with branches), and lots of merges and branches itself. I'd like the final git repository to keep all this history and be correct and complete when checking out earlier parts of the repository or other branches. I don't need the new repository to have submodules or subtrees, although I would accept a solution using that as well. Some methods I've seen merge all the subrepos at the top of the new repo as branches, which means that checking out in the past doesn't contain all the files that were in subrepos. I've also tried importing everything as branches, resetting the head into the past, merging, and rebasing upwards, but there are too many merges and many conflicts arise, even with --preserve-merges, so I'd rather avoid this. I also couldn't find any way of replicating the mercurial subrepository update history in git as submodule update history. Does anyone have any ideas? Thank you.

推荐答案

遇到类似的问题(将带有子存储库的Mercurial项目移动到具有统一布局的Git上),我打算采用一种2倍方法:

Having a similar problem (moving a Mercurial project with subrepositories to Git with a unified layout) I intend to follow a 2-fold approach:

  1. 将您的子存储库转换为Mercurial中的统一项目布局 -在此处介绍: https://git- scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git#Mercurial
  1. convert your subrepositories into a unified project layout in Mercurial - this is covered here: Join multiple subrepos into one and preserve history in Mercurial
  2. now you can migrate to Git easily, I found the official docs the best resource, with a good note on how to clean up commit history (authors): https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git#Mercurial

我将自己进行测试,并将根据结果更新此答案...

I'm just about to test this myself and will update this answer according to the results...

这篇关于将带有子存储库的Mercury存储库迁移到git并保存历史记录的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆