Mercurial 仅合并某些变更集
好的,我们最近从 SVN 转换为 Mercurial。
我们正常使用TortoiseHG。
在我们的一个存储库中,我们拥有所有项目,C++ / .NET / ASP。我们有大约 100 个项目,全部使用公共库项目。
因此,为每个项目创建多个存储库将是一项非常困难的任务。
现在,我们有了 default
分支,假设是 branchA
。
我正在开发 BranchA
并向其添加我的超级更改,并且我更改了一个公共库,比方说一个扩展方法
我想将其提交给 branchA
和 default
,我该怎么办?
但是,我不希望将 branchA
中的所有更改合并到 default
中,并且我不希望 default 中的所有其他更改
希望这是足够的信息!
Ok, so we recently converted from SVN to Mercurial.
We are using TortoiseHG normally.
In our one repository we have all of our projects, C++ / .NET / ASP. We have about 100 projects, all using common library projects.
So it would be quite difficult task to create multiple repo's for each project.
Now, we have the default
branch, and let's say branchA
.
I'm working on BranchA
and adding my uber changes to it, and I change a common library, let's say an extension method
I want to commit this to branchA
and default
, how would I go about this?
However, I don't want all my changes from branchA
to be merged into default
, and I don't want all the other changes from default
Hopefully this is sufficient information!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
只是为了保持更新:有 graft 命令 实现在 Mercurial 中挑选樱桃。
Just to keep things a bit updated: there is the graft command which implements cherry-picking in Mercurial.
有一种方法可以避免这个问题。您可以在某些基线修订版的单独功能分支上进行所有更改,通常是最后一个版本的标签或其他一些稳定点
S
。这样,您的更改
X
将位于其自己的分支上,该分支可以与其他分支合并(合并M1
和M2
),而不会引入不需要的变更集:这只需要正常的
hg merge
操作;无需补丁,移植或MQ。There is a way to avoid this problem. You can make all your changes on separate feature branches from some baseline revision, typically the tag of the last release or some other stable point
S
.That way, your change
X
will be on its own branch which can be merged with other branches (mergesM1
andM2
) without introducing unwanted changesets:This only requires normal
hg merge
operations; no need for patches, Transplant or MQ.如果将公共代码分离到自己的存储库中,则可以使用子存储库将其包含在每个项目中。
顺便说一句,我建议为每个项目都有一个单独的存储库,尤其是在项目数量很多的情况下。
If you separate the common code into its own repository, you can use subrepos to include it in each project.
By the way, I would recommend to have a separate repository for each project, especially if there are so many.
想要的不是合并,而是择优挑选。您可以使用 https://www.mercurial-scm.org/wiki/TransplantExtension ,但请注意那里提到的并发症。
What is want is not merge, but cherry-pick. You can use https://www.mercurial-scm.org/wiki/TransplantExtension, but be aware about complications mentioned there.
您正在描述“樱桃采摘”或进行“部分合并”,这目前在 Mercurial 中是不可能的。您有几个选择:
default
分支。You're describing "cherry picking" or doing a "partial merge" which isn't possible with Mercurial currently. You have a few options:
default
branch.