Question

The Situation: I am new to Mercurial. I recently setup and have started using a repository in a model recommended to me (see Rudi's diagram below). Things have been going fine but I have run into my first practical application problem. Mercurial seems to be geared toward forward/blended merges and I would like to backup. I want to clean up our default and stable branch by starting with the vendor branch, re-make our changes and check it in as default. Then merge that into stable.

V1----V2-------------V3---------V4     Vendor
 \     \              \          \
  D1----D2---D3--D4-D5-D6-D7-D8---D9   default
                  \           \    \
                   S1----------S2---S3 stable

The Question: How do I start with the vendor branch as the parent, merge the default changes and commit them to the default branch?

I thought the following would do it, but the update changes the working directory.

hg update -C vendor
hg update default
hg merge
Was it helpful?

Solution

There are two ways to go this. The right one and the expedient one. I'll do the right one first:

hg update default
hg --config ui.merge=internal:other merge vendor

That updates your parent to default and the working directory to default and then merges in the contents from vendor, but does so using an internal merge tool that always picks the other option when there's any difference, so you'll have default looking like vendor after that merge (and commit).

The sneaky way is:

hg update -C vendor
hg debugsetparent default
hg commit

Where debugsetparent is a powertool that does the "parent change" part of update without actually updating the files in the working directory.

OTHER TIPS

Though it lacks the context this question and its answers provides, I found the official answer on Mercurial's Wiki.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top