Size: 2710
Comment:
|
Size: 2938
Comment: +how to keep other branches
|
Deletions are marked like this. | Additions are marked like this. |
Line 90: | Line 90: |
[[BR]]This assumes you want to get rid of your individual changesets (which are a dangling branch in oldrepo) and just keep the combined changeset. newrepo will now just have the combined changeset. |
[[BR]]This assumes you want to get rid of your individual changesets (which are a dangling [:Branch:branch] in oldrepo) and just keep the combined changeset. newrepo will now just have the combined changeset. |
Line 94: | Line 92: |
/!\ /!\ This will strip out '''all''' other branches, not just the one dangling branch ''that you don't want.'' | /!\ This will strip out '''all''' other branches, not just the one dangling branch ''that you don't want.'' If you have other branches that you want to keep, specify their [:Head:head] revisions or [:NamedBranches:branch names] on the [:Clone:clone] call: {{{hg clone -r tip -r branch1 -r branch2 -r branch3 oldrepo newrepo}}} |
Concatenating multiple changesets into one
(See also [:EditingHistory])
Problem
Suppose you want to concatenate the last k changesets of a [:Repository:repository]
into a single, combined changeset
Solution
Execute the following steps:
1: hg -R oldrepo update S
This [:Update:updates] the [:WorkingDirectory:working directory] to revision S. Specifically, this means that the contents of the working directory are changed to that of revision S, and that S becomes the [:Parent:parent] of the working directory.
2: hg -R oldrepo revert -r tip --all
This [:Revert:reverts] the working directory to its contents at [:Tip:tip]. Since the parent of the working directory is still S, this means that the combined contents of all changesets between S and S+k show up as the modifications in the working directory.
3: hg -R oldrepo commit -m "Combine changesets S+1..S+k"
[:Commit:Committing] these modifications creates a new changeset "S+k (combined)", containing combined changesets S+1 to S+k.
4: hg clone -r tip oldrepo newrepo
BRThis assumes you want to get rid of your individual changesets (which are a dangling [:Branch:branch] in oldrepo) and just keep the combined changeset. newrepo will now just have the combined changeset.
This will strip out all other branches, not just the one dangling branch that you don't want. If you have other branches that you want to keep, specify their [:Head:head] revisions or [:NamedBranches:branch names] on the [:Clone:clone] call:
hg clone -r tip -r branch1 -r branch2 -r branch3 oldrepo newrepo