4

I want to merge some stuff in mercurial using kdiff3. Therefore I installed kdiff3 and added the following to ~/.hgrc:

[extdiff]
cmd.kdiff3 =

[merge-tools]
kdiff3.args = $base $local $other -o $output

But Mercurial keeps calling FileMerge as merge tool. I first checked if kdiff3 is working at all. Calling it from spotlight opened it. Then I called it from the command line to check whether HG is not able to call it, but this also worked. Then I found somewhere the hint to pass the complete path in the .hgrc:

[extdiff]
cmd.kdiff3 = /Applications/kdiff3.app/Contents/MacOS/kdiff3

But this also didn't help. There is also no error message from kdiff3 when Mercurial wants to open the merge tool, only some strange errors from FileMerge.

Question is: Why is Mercurial refusing to open kdiff3?

2
  • Becoz u wanna RTFM, dude Commented Jan 25, 2016 at 9:34
  • @LazyBadger Thanks for this polite and helpful comment.
    – PVitt
    Commented Jan 25, 2016 at 11:39

1 Answer 1

5

Thanks to the endless efforts of one of the most polite user here on stack exchange, I finally figured out that the mercurial wiki seems to be outdated. There it says:

Add to ~/.hgrc:

[extensions] 
hgext.extdiff =

[extdiff]
cmd.kdiff3 =

[merge-tools]
kdiff3.args = $base $local $other -o $output

The extdiff extension is not needed, as I don't want to define a new hg kdiff3 command here.

But Mercurial has some more settings for the merge tool:

[ui]
merge = kdiff3

Regarding to the Mercurial help on merge tools, the ui.merge setting should not be necessary, as I specifically set a merge-tools configuration:

Mercurial uses these rules when deciding which merge tool to use:

  1. If a tool has been specified with the --tool option to merge or resolve, it is used. If it is the name of a tool in the merge-tools configuration, its configuration is used. Otherwise the specified tool must be executable by the shell.
  2. If the "HGMERGE" environment variable is present, its value is used and must be executable by the shell.
  3. If the filename of the file to be merged matches any of the patterns in the merge-patterns configuration section, the first usable merge tool corresponding to a matching pattern is used. Here, binary capabilities of the merge tool are not considered.
  4. If ui.merge is set it will be considered next. If the value is not the name of a configured tool, the specified value is used and must be executable by the shell. Otherwise the named tool is used if it is usable.
  5. If any usable merge tools are present in the merge-tools configuration section, the one with the highest priority is used.
  6. If a program named "hgmerge" can be found on the system, it is used - but it will by default not be used for symlinks and binary files.
  7. If the file to be merged is not binary and is not a symlink, then internal ":merge" is used.
  8. The merge of the file fails and must be resolved before commit.

I somehow have the feeling that Mercurial changed it's behavior here (or some other part of my system), because on all machines where I used kdiff3 I don't have the last setting in my .hgrc. However, adding ui.merge does the trick.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .