如何将两个Mercurial仓库合并为一个仓库 [英] How do I merge two Mercurial repos into a single one

查看:158
本文介绍了如何将两个Mercurial仓库合并为一个仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须分离Mercurial存储库.一个是项目的主要干线,另一个是具有一系列其他更改的分支.

I have to separate Mercurial repositories. One is the main trunk for the project, while the other is a branch with a set of additional changes.

项目存储库有一个中央位置,我希望在其中可以使用主干和分支.我想做的是将两个存储库合并为一个存储库,但是仍然允许通过标签或类似的东西来访问分支.这将使开发人员可以签出主要代码,但是如果需要进一步的更改,还可以切换到分支上工作.我还想确保主干中的任何代码都不会意外地进入分支.对分支的任何更改都应该是明确的和有意的.

There is one central location for the project repository, in which I'd like both the trunk and the branch to be available. What I'd like to do is merge the two repositories into a single one, but still allow the branch to be accessed via tags, or something similar. This would allow developers to check out the main code, but also be able to switch to working on the branch if it requires further changes. I also want to make sure that any code in the trunk doesn't accidentally make it into the branch. Any changes to the branch should be explicit and intentional.

完成此任务的最佳方法是什么?

What is the best way to accomplish this?

推荐答案

正如布兰登所说,只需将其从分支存储库推到主干,或将分支拉入主干即可.

As Brandon says, just push from the branch repo to the trunk, or pull the branch into the trunk.

然后,您可以选择是否要合并分支&将它们放在一起或分开放置.如果从分支推到主干,则可能会收到有关多个头的警告.如果要将它们分开,只需执行push -f. (拉动可能不会发出警告)

You can then choose if you want to merge branch & trunk together, or keep them separate. If you push from branch to trunk, you may get a warning about multiple heads. Just do a push -f if you want to keep them separate. (pull may not give a warning)

您可以将分支更改合并到主干,并且以后仍然可以在分支上做进一步的工作.总的来说,我会标记每个发行版,这样我就可以轻松返回到发布的所有内容.

You can merge the branch changes to the trunk and still be able to do further work on the branch later if you want. In general, I tag every release so I can easily get back to anything that went out the door.

创建分支时,是否将其克隆到另一个目录?如果是这样,将分支拉入中继仓库后将很难找到分支.您可能需要阅读书签来标记分支.另请参阅多个头如何工作.

When you created the branch, did you clone it to another directory? If so, it will be harder to find the branch after pulling it into the trunk repo. You may want to read up on bookmarks to label the branch. Also look at how multiple heads work.

注意:另一种选择是使用命名分支,该分支将被永久标记.您无需做任何额外的操作即可在以后切换到它.

Note: The other option is to use named branches which labels the branch permanently. You wouldn't need to do anything extra to switch over to it later.

这篇关于如何将两个Mercurial仓库合并为一个仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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