5

I have the three way merge window open in Mercurial:

local
base
other
  • I was on branch A: hg update A.
  • I want to merge with branch B : hg merge B

I want to know what is local, base, and other.

I read this How does the 3 way merge in Mercurial/Meld work? but could not get it.

Now I want to know which file from local, base, other I need to save? Do I need to make all files the same? Will this change files in other branches or it will only save in my current branch A only, and other branches won't be touched?

Community
  • 1
  • 1
user26
  • 3,937
  • 5
  • 22
  • 22

1 Answers1

3

In your example:

  • local is the last changeset on branch A.
  • other is the last changeset on branch B.
  • base is the newest changeset which is an ancestor of the both branches.

If you just do the commands that you listed above (hg update A, hg merge B) then you won't get a choice of which files to take because Mercurial will make that choice for you where it can.

The only time that you'll need to make a decision is if a file has been changed in both branches in a way that Mercurial can't automatically resolve. In that case, you'll be presented with your merge program of choice to resolve the conflicts. You have to look at the changes made in each branch and manually decide how they need to be combined. If another developer made one of the changes then you might need to ask them to help with the merge.

If you do hg update A, hg merge B then the only branch that will be affected is A.

Steve Kaye
  • 6,262
  • 2
  • 23
  • 27
  • For example i made chnage in `branch B` and then some chnage in `branch A`. Now i get the `meld` tool with three files. now i want to know that which file from local , other , base , will be saved for branch A. bceause i don't want to touch branch B' file because that was bug fix branch – user26 Sep 10 '13 at 00:33
  • Typically the one in the middle. If you don't know how to use meld, don't use it. I always use ui.merge=internal:merge with Mercurial. For me, this is much preferable. – Ringding Sep 10 '13 at 06:42
  • 3
    What is still missing here is which of the three open filenames to put the merged version in and save. – Steve Kroon Nov 10 '14 at 09:03