Yaron Cohen-Tal
Yaron Cohen-Tal

Reputation: 2195

In Mercurial, how to edit a past changeset when the history contains merges?

I have the following history:

@    4 changesABC tip
|\
| o  3 changesAB
| |
o |  2 changesAC
|/
o  1 changeA
|
o  0 initial.

Now i want to make a change to changeset 1, so that the change is reflected in its descendants. If i try:

hg histedit 1

I get:

abort: cannot edit history that contains merges

Any way to go around this? I find this scenario very common; it would be really helpful if I could do this.

Upvotes: 3

Views: 1069

Answers (1)

planetmaker
planetmaker

Reputation: 6044

There is no easy way to do so, and that also holds (still) true for the evolve extension (mind, it's still indicated as experimental). However when trying the same thing as you with evolve active, it suggests:

Abbort: no support for evolving merge changesets yet (Redo the merge and use 'hg prune <old> --succ <new>' to obsolete the old one)

The workflow with evolve extension enabled would then look like: hg up 1 (make changes) hg evolve -a You then need to re-do the merge as suggested and then you should be done (please use the appropriate revisions, just typing by heart): hg merge -r6 hg prune 4 --succ NEW_MERGE_CHANGESET Mind, that this only works on non-public changesets, thus you would need to force a phase change prior to these operations.

Upvotes: 2

Related Questions