[PATCH] mergetools: add nbdime merge tools to default rc

Yuya Nishihara yuya at tcha.org
Sun Nov 26 06:33:58 EST 2017


On Sat, 25 Nov 2017 13:34:58 +0100, Vidar Tonaas Fauske wrote:
> exporting patch:
> # HG changeset patch
> # User Vidar Tonaas Fauske
> # Date 1510750467 -3600
> #      Wed Nov 15 13:54:27 2017 +0100
> # Node ID 7072463ab05996c7ae12ea4a6ccb9da305c54a53
> # Parent  75013952d8d9608f73cd45f68405fbd6ec112bf2
> mergetools: add nbdime merge tools to default rc
> 
> Adds default configuration for nbdime merge tools for the Jupyter notebook
> format (a structured JSON document). If the user has nbdime installed, this
> change will cause mercurial to use it by default (but with a low priority).
> 
> Why is it a good idea to use a different tool for Notebooks? Because the default
> merge tool can produce invalid documents (non-valid JSON), meaning the user
> has to edit the JSON by hand (which is not the intenion). The nbdime merge tool
> ensures that the output is always a valid notebook, even when conflicted.
> 
> diff -r 75013952d8d9 -r 7072463ab059 mercurial/default.d/mergetools.rc
> --- a/mercurial/default.d/mergetools.rc Fri Nov 10 19:14:06 2017 +0800
> +++ b/mercurial/default.d/mergetools.rc Wed Nov 15 13:54:27 2017 +0100
> @@ -144,3 +144,24 @@
>  UltraCompare.binary = True
>  UltraCompare.check = conflicts,changed
>  UltraCompare.diffargs=$child $parent -title1 $clabel -title2 $plabel1
> +
> +# Nbdime for merging Jupyter notebooks:
> +#   merge driver:

Nit: I'm not sure what this "merge driver" and "merge tool" mean, and the
term "merge driver" seems to have a different meaning in Mercurial. Can you
elaborate?

> +nbdime.priority = 2
> +nbdime.premerge = False
> +nbdime.executable = hg-nbmerge
> +nbdime.args = $base $local $other $output
> +#   merge tool:
> +nbdimeweb.priority = 1
> +nbdimeweb.premerge = False
> +nbdimeweb.executable = hg-nbmergeweb
> +nbdimeweb.args = --log-level ERROR $base $local $other $output
> +nbdimeweb.gui = True

These priorities seem too high compared to the other tools. I think these
tools should have quite low priority so they won't be selected as a general-
purpose merge tool.

> +# Default association of file types with merge tools
> +
> +[merge-patterns]
> +
> +**.ipynb = nbdime

Registering merge-tools by default is good, but I don't think we should force
users to select them by default. Can you send new patch that only registers
merge-tools?


More information about the Mercurial-devel mailing list