如何将一些修订从一个分支移动到另一个分支?
How to move some revisions from one branch to another?
hg convert --branchmap
允许将一个分支中的所有修订移动到不同的分支。在一个有多个头的分支中(例如,一条路径通向 "closed branch"),我如何将一些修订移动到不同的分支,同时保持其他修订不变?
You should be able to achieve this using "histedit". Use the "edit" action on the first changesets and set up branch name before committing.
例如,假设我们有:
@ changeset: 3:acd042300874
| tag: tip
| user: user@name.com
| date: Tue Sep 27 11:22:33 2016 -0400
| summary: commit4
|
o changeset: 2:6cd4bf5a3e25
| parent: 0:7f1fbf9d8623
| user: user@name.com
| date: Tue Sep 27 11:22:33 2016 -0400
| summary: commit3
|
| o changeset: 1:5cf7adbb92ea
|/ user: user@name.com
| date: Tue Sep 27 11:22:32 2016 -0400
| summary: commit2
|
o changeset: 0:7f1fbf9d8623
user: user@name.com
date: Tue Sep 27 11:22:32 2016 -0400
summary: commit1
我们想将修订版 2、3 移动到不同的分支,我们将执行以下操作:
- 汞更新 3
- hg histedit 2
- 将两个修订版从 "pick" 更改为 "edit"
- hg 分支 "new-branch"
- hg commit -m "old commit message for rev2"
- hg histedit --继续
- hg commit -m "old commit message for rev3"
- hg histedit --继续
将 branchmap
和 splicemap
选项组合使用到 hg convert
。可能不止一步,具体取决于您需要做什么。
hg convert --branchmap
允许将一个分支中的所有修订移动到不同的分支。在一个有多个头的分支中(例如,一条路径通向 "closed branch"),我如何将一些修订移动到不同的分支,同时保持其他修订不变?
You should be able to achieve this using "histedit". Use the "edit" action on the first changesets and set up branch name before committing.
例如,假设我们有:
@ changeset: 3:acd042300874
| tag: tip
| user: user@name.com
| date: Tue Sep 27 11:22:33 2016 -0400
| summary: commit4
|
o changeset: 2:6cd4bf5a3e25
| parent: 0:7f1fbf9d8623
| user: user@name.com
| date: Tue Sep 27 11:22:33 2016 -0400
| summary: commit3
|
| o changeset: 1:5cf7adbb92ea
|/ user: user@name.com
| date: Tue Sep 27 11:22:32 2016 -0400
| summary: commit2
|
o changeset: 0:7f1fbf9d8623
user: user@name.com
date: Tue Sep 27 11:22:32 2016 -0400
summary: commit1
我们想将修订版 2、3 移动到不同的分支,我们将执行以下操作:
- 汞更新 3
- hg histedit 2
- 将两个修订版从 "pick" 更改为 "edit"
- hg 分支 "new-branch"
- hg commit -m "old commit message for rev2"
- hg histedit --继续
- hg commit -m "old commit message for rev3"
- hg histedit --继续
将 branchmap
和 splicemap
选项组合使用到 hg convert
。可能不止一步,具体取决于您需要做什么。