我有两个 mercurial 存储库,generic
并且specific
是第一个 repo 的克隆:
$ hg glog -R generic
@ changeset: 0:d516ded3bf0a
summary: generic project commit
$ hg glog -R specific
@ changeset: 3:5f7b2efea94b
| summary: added another specific project change
o changeset: 2:e2ad52001bcf
| summary: added generic project change (backport)
o changeset: 1:a4220a2c7a80
| summary: added specific project change
o changeset: 0:d516ded3bf0a
summary: generic project commit
现在我想将变更集 2 反向移植specific
到generic
. 我不想添加变更集 1 和 3,只添加 cs 2(cherry-pick)。似乎有两种选择:移植和移植。移植是可以的,因为它允许从另一个存储库移动补丁(在我的情况下从specific
to generic
),但它在合并功能方面受到限制。另一方面,嫁接将提供更智能的合并,但不支持从另一个 repo 嫁接(仅在同一分支之间)。
目标是仅将变更集 2 添加specific
到generic
. 我就是这样进行的,没有成功。
$ cd specific
$ hg up 0 # the common ancestor
$ hg branch backport-cs2
$ hg graft 2
$ hg glog
@ changeset: 4:1405acc4a121
| branch: backport-cs2
| tag: tip
| parent: 0:d516ded3bf0a
| summary: added generic project change (backport)
|
| o changeset: 3:5f7b2efea94b
| | summary: added another specific project change
| |
| o changeset: 2:e2ad52001bcf
| | summary: added generic project change (backport)
| |
| o changeset: 1:a4220a2c7a80
|/ summary: added specific project change
|
o changeset: 0:d516ded3bf0a
summary: generic project commit
到目前为止,一切都很好。最后一步是将的分支拉到的默认分支backport-cs2
中。specific
generic
$ cd ../generic
$ hg pull -b backport-cs2 ../specific
$ hg glog
o changeset: 1:1405acc4a121
| branch: backport-cs2
| tag: tip
| summary: added generic project change (backport)
|
@ changeset: 0:d516ded3bf0a
summary: generic project commit
现在generic
有我想要的变更集,但它在一个新分支中,而我希望将其设为默认值。任何建议如何做到这一点?更好的反向移植方法的想法也受到赞赏。