Mercurial продолжает запускать FileMerge вместо kdiff3

1046
PVitt

Я хочу объединить некоторые вещи в Mercurial, используя kdiff3. Поэтому я установил kdiff3 и добавил следующее ~/.hgrc:

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

Но Mercurial продолжает вызывать FileMerge как инструмент слияния. Сначала я проверил, работает ли kdiff3 вообще. Звонок от прожектора открыл его. Затем я вызвал его из командной строки, чтобы проверить, не может ли HG вызвать его, но это также сработало. Тогда я нашел где-то подсказку, чтобы пройти полный путь в .hgrc:

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

Но это тоже не помогло. Когда Mercurial хочет открыть инструмент слияния, также нет сообщения об ошибке от kdiff3, только некоторые странные ошибки из FileMerge.

Вопрос: почему Mercurial отказывается открывать kdiff3?

2
Becoz u wanna [RTFM] (https://www.selenic.com/mercurial/hgrc.5.html#ui), чувак Lazy Badger 8 лет назад 0
@LazyBadger Спасибо за этот вежливый и полезный комментарий. PVitt 8 лет назад 0

1 ответ на вопрос

3
PVitt

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.