2017-10-11 116 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)所有移植的更改集發佈分支,只要你將它們保存在階段草稿中。

相關問題