changeset 45791:5effb1992c17

config: move ui.pre-merge-tool-output-template into [command-templates] Differential Revision: https://phab.mercurial-scm.org/D9249
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 26 Oct 2020 10:33:32 -0700
parents 40411ad2f5d2
children b4c193509cd0
files mercurial/configitems.py mercurial/filemerge.py mercurial/helptext/config.txt tests/test-histedit-merge-tools.t
diffstat 4 files changed, 46 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/configitems.py	Fri Oct 23 15:59:32 2020 -0700
+++ b/mercurial/configitems.py	Mon Oct 26 10:33:32 2020 -0700
@@ -245,6 +245,12 @@
     ),
     alias=[(b'ui', b'mergemarkertemplate')],
 )
+coreconfigitem(
+    b'command-templates',
+    b'pre-merge-tool-output',
+    default=None,
+    alias=[(b'ui', b'pre-merge-tool-output-template')],
+)
 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
 coreconfigitem(
     b'commands', b'commit.post-status', default=False,
@@ -1346,9 +1352,6 @@
     b'ui', b'patch', default=None,
 )
 coreconfigitem(
-    b'ui', b'pre-merge-tool-output-template', default=None,
-)
-coreconfigitem(
     b'ui', b'portablefilenames', default=b'warn',
 )
 coreconfigitem(
--- a/mercurial/filemerge.py	Fri Oct 23 15:59:32 2020 -0700
+++ b/mercurial/filemerge.py	Mon Oct 26 10:33:32 2020 -0700
@@ -643,7 +643,7 @@
 
 
 def _describemerge(ui, repo, mynode, fcl, fcb, fco, env, toolpath, args):
-    tmpl = ui.config(b'ui', b'pre-merge-tool-output-template')
+    tmpl = ui.config(b'command-templates', b'pre-merge-tool-output')
     if not tmpl:
         return
 
--- a/mercurial/helptext/config.txt	Fri Oct 23 15:59:32 2020 -0700
+++ b/mercurial/helptext/config.txt	Mon Oct 26 10:33:32 2020 -0700
@@ -2440,14 +2440,7 @@
       On Windows, this configuration option is ignored and the command aborted.
 
 ``pre-merge-tool-output-template``
-    A template that is printed before executing an external merge tool. This can
-    be used to print out additional context that might be useful to have during
-    the conflict resolution, such as the description of the various commits
-    involved or bookmarks/tags.
-
-    Additional information is available in the ``local`, ``base``, and ``other``
-    dicts. For example: ``{local.label}``, ``{base.name}``, or
-    ``{other.islink}``.
+    (DEPRECATED) Use ``command-template.pre-merge-tool-output`` instead.
 
 ``quiet``
     Reduce the amount of output printed.
@@ -2575,6 +2568,16 @@
 
     Can be overridden per-merge-tool, see the ``[merge-tools]`` section.
 
+``pre-merge-tool-output``
+    A template that is printed before executing an external merge tool. This can
+    be used to print out additional context that might be useful to have during
+    the conflict resolution, such as the description of the various commits
+    involved or bookmarks/tags.
+
+    Additional information is available in the ``local`, ``base``, and ``other``
+    dicts. For example: ``{local.label}``, ``{base.name}``, or
+    ``{other.islink}``.
+
 
 ``web``
 -------
--- a/tests/test-histedit-merge-tools.t	Fri Oct 23 15:59:32 2020 -0700
+++ b/tests/test-histedit-merge-tools.t	Mon Oct 26 10:33:32 2020 -0700
@@ -12,8 +12,6 @@
   > [extensions]
   > histedit=
   > mockmakedate = $TESTDIR/mockmakedate.py
-  > [ui]
-  > pre-merge-tool-output-template='pre-merge message for {node}\n'
   > EOF
 
 Merge conflict
@@ -21,6 +19,11 @@
 
   $ hg init r
   $ cd r
+  $ cat >> .hg/hgrc <<EOF
+  > [command-templates]
+  > pre-merge-tool-output='pre-merge message for {node}\n'
+  > EOF
+
   $ echo foo > file
   $ hg add file
   $ hg ci -m "First" -d "1 0"
@@ -55,3 +58,26 @@
   merging file
   pre-merge message for b90fa2e91a6d11013945a5f684be45b84a8ca6ec
   7181f42b8fca: skipping changeset (no changes)
+  $ hg histedit --abort
+  abort: no histedit in progress
+  [255]
+  $ cd ..
+
+Test legacy config name
+
+  $ hg init r2
+  $ cd r2
+  $ echo foo > file
+  $ hg add file
+  $ hg ci -m "First"
+  $ echo bar > file
+  $ hg ci -m "Second"
+  $ echo conflict > file
+  $ hg co -m 0 --config ui.merge=false \
+  > --config ui.pre-merge-tool-output-template='legacy config: {node}\n'
+  merging file
+  legacy config: 889c9c4d58bd4ce74815efd04a01e0f2bf6765a7
+  merging file failed!
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+  [1]