Patchwork D9249: config: move ui.pre-merge-tool-output-template into [command-templates]

login
register
mail settings
Submitter phabricator
Date Oct. 27, 2020, 5:57 a.m.
Message ID <differential-rev-PHID-DREV-b4ipp6shk7oztcsy4qt6-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47520/
State Superseded
Headers show

Comments

phabricator - Oct. 27, 2020, 5:57 a.m.
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9249

AFFECTED FILES
  mercurial/configitems.py
  mercurial/filemerge.py
  mercurial/helptext/config.txt
  tests/test-histedit-merge-tools.t

CHANGE DETAILS




To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-histedit-merge-tools.t b/tests/test-histedit-merge-tools.t
--- a/tests/test-histedit-merge-tools.t
+++ b/tests/test-histedit-merge-tools.t
@@ -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]
diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
--- a/mercurial/helptext/config.txt
+++ b/mercurial/helptext/config.txt
@@ -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``
 -------
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -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
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -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(