Search code examples
mercurial

What is allowed in the Mercurial INI (hgrc) ui "merge" option?


Mercurial can be configured using a mercurial.ini (or .hgrc) file. In the [ui] section (docs) there is a merge option.

This option is only documented as follows:

merge

The conflict resolution program to use during a manual merge.

In my current configuration I just have the line:

merge = kdiff3

But what is the allowed syntax for this setting? For instance, can I provide command line options to the specified program? Can I use an absolute path? etc.

Thanks


Note - the above cited docs do suggest looking in another link for more related information (https://www.selenic.com/mercurial/hg.1.html#merge-tools) but this does not specifically cover the configuration section I am interested in.


Solution

  • The approach isn't to add options to the [ui]\merge entry but instead to further configure the merge tool elsewhere.

    The page on kdiff3 in the mercurial wiki is more elaborate on how you can configure kdiff3 with mercurial by using the [extdiff] and [merge-tools] sections. Excerpt:

    [extensions]
    hgext.extdiff =
    
    [extdiff]
    cmd.kdiff3 =
    
    [merge-tools]
    kdiff3.args = $base $local $other -o $output
    

    That will add a new graphical diff command hg kdiff3 (using ExtdiffExtension), and tells Mercurial to use kdiff3 for merges.