Mercurial Diff Merge: What tool is this and how do I use it?

15,739

Solution 1

This is vimdiff. You can learn more about it by running man vimdiff.

However, I would recommend using mercurial's internal:merge tool. It will perform the merge and, if a conflict occurs, insert conflict markers in the file and notify you that there was a conflict. You then open up the file, resolve the conflict, remove the conflict markers, mark the file as resolved, and when all files are cleaned up you can commit the result of the merge. This is very similar to how subversion handles conflicts. You can configure mercurial to use internal:merge by adding the following to your ~/.hgrc file:

[ui]
merge=internal:merge

The tool you'll use to get the list of conflicted files and mark them resolved is called hg resolve, so I would recommend running hg help resolve to learn more about that tool. You can learn more about mercurial's support for merge tools by running: hg help merge-tools.

Solution 2

Seems like you need some help in using Vim's diff module. See one of these:

If you're not comfortable using Vim, there's surely an option that lets you specify your own favourite diff tool, but I don't know HG, so I can't tell you which option you'll have to modify.

The opened Vim has three files being diffed, so I guess you ran into some conflicts when doing the hg update.

Solution 3

From my experience, the tool which is - by far - easiest to use for most people is kdiff3 (intuitive menu, natural view with base and both tips above and resulting text below, good keyboard shortcuts - Ctrl-1/Ctrl-2/Ctrl-3 to pick snippet from first/second/third window, Ctrl-arrows to jump from conflict to conflict). Just install this program and give it highest priority in merge-tools configuration (set

[merge-tools]
kdiff3.priority=1000

).

In general: whichever tool you use, it shows you conflicted versions of the file and expects you to create the final version.

Share:
15,739

Related videos on Youtube

HyderA
Author by

HyderA

Updated on May 18, 2020

Comments

  • HyderA
    HyderA almost 4 years

    I am new to mercurial, I am quite familiar with TortoiseHG, but this is the first time I am managing a project in a headless linux environment. I do an hg update after a push, and I get this screen:

    enter image description here

    Help section says it's vim, how do I go about merging my application.

    • pedrosaurio
      pedrosaurio about 6 years
      Three answers without an actual answer
  • nelstrom
    nelstrom almost 13 years
    I made a screencast demonstrating how to perform a 3 way merge conflict in Vim. The example uses git instead of mercurial, but the same principles apply.
  • Conspicuous Compiler
    Conspicuous Compiler over 10 years
    Although I appreciate you're trying to be helpful, neither of those links deal with a three-file diff, and they offer almost entirely duplicate information. I don't think they help answer the asked question at all.