Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 658109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:53:50+00:00 2026-05-13T22:53:50+00:00

Note: The scenario I describe here is not answered in Stack Overflow: Completely manual

  • 0

Note: The scenario I describe here is not answered in Stack Overflow: Completely manual Mercurial merge.

I will explain my query with an example. Assume I start off a Mercurial repository to design a car:

C:\Car$ dir
Car.cpp
Car.h

I work on the design of Car for quite a while and the repository looks like:

r0-r1-...-r100-(default)

At some point in time I branch default to SolarCarBranch to work on a solar powered car in parallel:

C:\SolarCar$ dir
Car.cpp
Car.h
Solar.cpp
Solar.h

After some more time, the repository looks like:

r0-r1-...-r100-...-r200-(default)
            \--r101-...-r201-(SolarCarBranch)

How do I merge SolarCarBranch back to default?

Take note of the following complications in the merge I want:

  1. I should be able to continue work on both default and SolarCarBranch after the merge.
  2. There might be fuel efficiency fixes in Car.cpp and Car.h in SolarCarBranch that I want pulled into default, however I do not want all the changes in those files. So, I want to cherry pick the changes I want to be included in default during the merge (aka manual merge).
  3. I do not want Solar.cpp and Solar.h appearing in default. The world may not yet be ready for a solar powered car. 😉

What I have learned:

  1. This is possible by a hg merge SolarCarBranch
  2. This can be achieved by setting kdiff3.premerge=False in Mercurial.ini
  3. I do not know how to achieve this since premerge=False still merges/copies Solar.cpp and Solar.h into default without asking me for permission.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:53:50+00:00Added an answer on May 13, 2026 at 10:53 pm

    You’re really close and you don’t need to resort to Transplant (yuck) or cherry picking in general. Turning off premerge is the first step, and then just remove the files you don’t want in the main branch after merging but before committing. You’ll only have to do it once.

    Here’s a setup:

    o  changeset:   3:343d531512a3
    |  branch:      solar
    |  tag:         tip
    |  parent:      1:cb26642f8db5
    |  user:        Ry4an Brase <ry4an@msi.umn.edu>
    |  date:        Wed Mar 10 11:16:48 2010 -0600
    |  files:       afile
    |  description:
    |  solar-change
    |
    |
    | @  changeset:   2:c5d14e34db07
    | |  parent:      0:56465175b2fc
    | |  user:        Ry4an Brase <ry4an@msi.umn.edu>
    | |  date:        Wed Mar 10 11:05:44 2010 -0600
    | |  files:       other-main-file
    | |  description:
    | |  moremain
    | |
    | |
    o |  changeset:   1:cb26642f8db5
    |/   branch:      solar
    |    user:        Ry4an Brase <ry4an@msi.umn.edu>
    |    date:        Wed Mar 10 11:04:32 2010 -0600
    |    files:       solar-only
    |    description:
    |    solar-initial
    |
    |
    o  changeset:   0:56465175b2fc
       user:        Ry4an Brase <ry4an@msi.umn.edu>
       date:        Wed Mar 10 11:04:14 2010 -0600
       files:       afile
       description:
       initial
    

    You can see that changeset 1 adds a file to the solar branch — a file we don’t want in default. While changeset 3 tweaks a file that also exists in main, afile, and we want to manually control whether or not that change happens.

    So do hg update default ; hg merge -r solar. The merge tool will pop up for afile and we decide line-by-line or chunk-by-chunk if we want those changes. After saving do a hg stat:

    % hg stat
    M afile
    M solar-only
    

    And we see that solar-only is queued up for commiting in default. Just remove it (with if).

    % hg rm -f solar-only
    

    Now hg stat shows it as removed:

    % hg stat
    M afile
    R solar-only
    

    and when we commit we’ll have what we want in the new changeset.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Note: Not sure if this is the right stack, please tell if I should
I have problem with the autoload function here is the scenario: Note: the MVC
For the 2nd <h3>World!</h3> in this sample scenario ( Please note <..> elements are
Note, this is not a duplicate of .prop() vs .attr() ; that question refers
(Note: This is not a question about what is the best way with code
Note: I am not asking how to use Google Code's SVN repo as a
NOTE: This is a followup to my question here. I have a program that
NOTE: This is an old question and the answers here no longer works (since
Consider this scenario. I have some business logic that now and then will be
Example Scenario: Note, this can be as deep or as shallow depending on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.