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

Vidar Tonaas Fauske vidartf at gmail.com
Sat Nov 25 12:34:58 UTC 2017


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:
+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
+
+
+
+# Default association of file types with merge tools
+
+[merge-patterns]
+
+**.ipynb = nbdime


More information about the Mercurial-devel mailing list