Differences between revisions 11 and 12
Revision 11 as of 2008-04-05 10:02:42
Size: 2949
Editor: abuehl
Comment:
Revision 12 as of 2008-04-05 10:10:40
Size: 2855
Editor: abuehl
Comment: rm imprecise sentence, use "changeset" instead of "revision"
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
which you want to combine into a single changeset. This can be done using operations
[:Clone:clone], [:Push:push], and [:Pull:pull]. But l
et's make the following assumptions:
which you want to combine into a single changeset. Let's make the following assumptions:
Line 9: Line 8:
 * The repository in question has a single [:Head:head], and you want to combine the last k [:Revision:revisions] into a single revision.
 * The base revision is called R, and the ending revision is called R+k.
 * The repository in question has a single [:Head:head], and you want to combine the last k changesets into a single changeset.
 * The base changeset is called R, and the ending changeset is called R+k.
Line 13: Line 12:
What we do is create a [:Branch:branch] whose root revision is R and which consists of one[[FootNote(Actually it can be multiple changesets. The principle is the same, but for simplicity let us assume one.)]] changeset (result of step 3 below). The procedure is as follows: What we do is create a [:Branch:branch] whose root changeset is R and which consists of one[[FootNote(Actually it can be multiple changesets. The principle is the same, but for simplicity let us assume one.)]] changeset (result of step 3 below). The procedure is as follows:

Concatenating multiple changesets into one

(See also [:EditingHistory])

Suppose you have a [:Repository:repository] with a number of [:ChangeSet:changesets] which you want to combine into a single changeset. Let's make the following assumptions:

  • The repository in question has a single [:Head:head], and you want to combine the last k changesets into a single changeset.

  • The base changeset is called R, and the ending changeset is called R+k.
  • The repository has no [:LocalModifications:local modifications].

What we do is create a [:Branch:branch] whose root changeset is R and which consists of oneFootNote(Actually it can be multiple changesets. The principle is the same, but for simplicity let us assume one.) changeset (result of step 3 below). The procedure is as follows:

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 "Combined changesets between R and 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.


CategoryTipsAndTricks

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