Differences between revisions 15 and 16
Revision 15 as of 2008-04-06 09:53:57
Size: 2487
Editor: abuehl
Comment:
Revision 16 as of 2008-04-06 10:00:07
Size: 2463
Editor: abuehl
Comment: link to PruningDeadBranches is just confusing here
Deletions are marked like this. Additions are marked like this.
Line 85: Line 85:
 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.  [[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.

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"

  • [:Commit:Committing] these modifications creates a new changeset "R+k (combined)", containing combined changesets R+1 to R+k.

4: hg clone -r tip oldrepo newrepo

  • BRThis 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.


CategoryTipsAndTricks

ConcatenatingChangesets (last edited 2013-10-10 10:48:33 by RamiroMorales)