Mercurial 中的父/子项目关系
我是 Mercurial(以及一般的 SCM)的新手,并且我一直致力于处理两个项目之间的父子关系。一个项目是父项目,并且是另一个项目的子集(或者更确切地说,另一个项目是第一个项目的超集)。我想在一个本地存储库中处理这两个项目,就像它们是一个一样,但我想将它们发布到两个不同的公共存储库。
我查看了子存储库,但这不是我想要的,因为我需要我的存储库在同一根目录上工作。我的猜测是使用分支,但将更改合并到超级项目中不需要添加新文件吗?
最简单/正确的方法是什么?
I'm new to mercurial (and SCM in general) and I'm stuck at handling a parent child relationship between my two projects. One project is the parent project and is a subset of the other project (or rather, the other one is a superset of the first). I want to work on the two projects in a single local repository as if they were one but I want to publish them to two different public repositories.
I've looked at sub-repositories but that's not what I want since I need my repositories to work on same root directory. My guess would be to use branching but wouldn't merging the changes in to the super-project require the addition of new files ?
What would be the simplest/correct way to do this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想,如果您四处寻找“供应商分支”的答案,您会发现它们也涵盖了您的情况。
基本要点是确保您想要保留的任何更改都是子集存储库仅来自该子集的更改集作为祖先。这是一个粗略的图片:
使用这样的存储库,您在子集中所做的任何更改都可以轻松
hg pull
到 superset1 和/或 superset2 中。例如,如果您在子集中添加新功能,您的存储库现在可能如下所示:将它们拉入 superset1 和 superset2 后,您将拥有:
然后您只需在 superset1 中
hg merge
和 superset2 得到:将更改从 superset1 移动到 superset2 或从任一超集移动到子集不太干净,因此在子集中进行更改并将其拉出/合并到超集中,然后就可以开始了。
I think if you look around for 'vendor branch' answers you'll find they cover your case too.
The basic jist is to make sure that any change you want to stay is the subset repository has only changesets from that subset as ancestors. Here's a crude picture:
With repositories like that any change you make in subset can be easily
hg pull
ed into superset1 and/or superset2. If, for example, you add a new feature in subset your repos might now look like this:and after pulling those into superset1 and superset2 you'd have:
and then you'd just
hg merge
in superset1 and superset2 to get:Moving changes from superset1 to superset2 or from either superset to the subset is much less clean, so make the change in the subset and pull/merge it into the supersets and you're good to go.