将多个子存储库合并为一个并在 Mercurial 中保留历史记录
目前我有一个由多个存储库组成的项目,例如:
+---Project (main repo) +---Core (subrepo) +---Web (subrepo) \---Tests (subrepo)
不幸的是,子存储库之间的代码耦合度很高,因此它不能很好地与分支一起工作。
有没有办法将子存储库合并到一个主存储库中以保留历史记录?
Currently I have project consisting of multiple repositories, e.g.:
+---Project (main repo) +---Core (subrepo) +---Web (subrepo) \---Tests (subrepo)
Unfortunately the code between subrepos is quite coupled so it doesn't work nicely with branches.
Is there any way to consolidate the subrepos into one main repository preserving the history?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我首先将
hg Convert
与排除.hgsub
和子存储库的文件映射一起使用。接下来,在子存储库上使用hg Convert
并重命名文件映射中的条目,例如:rename 。 Core
拥有这些新存储库后,您可以使用
hg pull -f
将变更集从转换后的子存储库一次导入到转换后的主存储库中。您还需要将它们合并到新的主存储库中(它们形成单独的头,并将空修订版作为最近的共同祖先)。I would start with using
hg convert
with a filemap that excludes the.hgsub
and the subrepos. Next, usehg convert
on the subrepos with rename entries in the filemap like:rename . Core
Once you have those new repos, you can use
hg pull -f
to import the changesets from the converted subrepos into the converted main repo one at a time. You'll also need to merge them into your new main repo (they form separate heads with the null revision as the most recent common ancestor).第一个猜测:
也许通过使用 转换扩展 和文件映射?
另一种尝试:
编辑:添加更多详细信息,然后再尝试
First guess :
Perhaps by using the convert extension with a filemap ?
Another try :
Edit : added more details, and another try
假设您不必转换存储库,为什么不简单地将每个存储库推送到中央存储库中呢?
Assuming you don't have to convert repos, why not simply push each repo in the central one?