2017-10-11 114 views
0

我从default创建了一些分支(称为brnch),并在那里进行了一些提交。现在需要将分支中的所有差异选择到某个发布分支以进行修复。在mercurial中有这样的可能吗?为分支中的所有更改创建diff修补程序?

^^ 
    | |<--- brnch 
    | - commit3 
    | | 
    | - commit2 
    - | 
    | | 
    | - commit1 
    - | 
    | | 
    | | 
    |-- 
    | 
    - 
default 

是否有可能创建分支brnch(commit1,commit2,commit3)所有commmits补丁和应用到某些另一个分支(发布在我的情况烫)?

回答

1

请参阅hg help exporthg help import

例子:

hg export branch(brnch) -o brnch.patch    # export everything on brnch 
hg export -r commit1 -r commit2 -o cherrypick.patch # cherrypick two changesets 

hg update <somewhere_else> 
hg import brnch.patch # import the revisions in the patch 

hg import --no-commit brnch.patch # import (but don't commit) revisions. 
hg commit -m hotfix    # commit changes as one commit with "hotfix" description. 
1

您可以通过简单的hg rebase手段实现这一目标。

为简单起见,我会假设你想看到你的brnch一切从commit1以后看把你发布分支。因此检出发布分支,然后衍合brnch提交:

hg update release 
hg rebase --source commit1 --collapse --keep --dest . --message "bla bla something fixed" 

或者你可以给一个版本范围。如果您希望看到的提交崩溃在分支中是非线性的,那么您将需要使用移植(这是挑选单个提交) - 并且可以随后在您的系统中折叠(hg fold)所有移植的更改集发布分支,只要你将它们保存在阶段草稿中。

相关问题