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 update R
This [:Update:updates] the [:WorkingDirectory:working directory] to revision R. Specifically, this means that the contents of the working directory are changed to that of revision R, and that R becomes the [:Parent:parent] of the working directory.
2: hg 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 R, this means that the combined contents of all changesets between R and R+k show up as the modifications in the working directory.
3: hg ci -m "Combine changesets R+1..R+k"
At this point, [:Commit:committing] these modifications will create a changeset containing all combined changesets between revisions R and R+k.
4: hg clone -r tip oldrepo newrepo
This assumes you want to get rid of your individual changesets (which are a dangling branch in oldrepo) and just keep the combined changeset (see also [:PruningDeadBranches]). newrepo will now just have the combined changeset.