"How I got bitten when merging" scenario

Sébastien Pierre sebastien at xprima.com
Fri May 5 10:31:53 CDT 2006


Hi all,

In my naive use of Mercurial, I came up with an interesting scenario,
where I got somewhat mislead by the names of the commands. 

Here is the context:

 v1 -- v2 -- v3 -- v4 -- v5 (tip)
                \     
                 - v3.a

I wanted to merge v5 (r6) and v3.a (r5). Here is what I did:

$ hg update -C 5   (let's get back to v3.a)
$ hg merge 6       (and merge the latest changes from here)

Then "Oops, I did not want to do that, I think I will make some more
changes first".

$ hg revert
$ hg status

"Ahhh, I remember that merge added a new parent..."

$ hg parents

"Ok, so I just want to undo the merge and go back to where I was before
all this."

$ hg undo

And here, I am now at v4, and v5 was "uncommited" from the repository.
No "redo" to "undo the undo", so I guess my v5 changeset is lost.

I know that this is probably no kosher use of Mercurial, but it can be
pretty confusing, and especially the last "undo" that actually undoes
the commit and not the merge.

I would have expected the command sequence for this scenario to work
like this:

$ hg update -C 5     (go back to v3.a)
$ hg merge           (merge with the tip)
$ hg undo            (undo the merge)

 -- Sébastien





More information about the Mercurial mailing list