diff tests/test-log.t @ 45765:ed84a4d48910

config: add a new [command-templates] section for templates defined by hg The existing `[templates]` section lets the user define their own keys and then refer to them on the command line with `-T`. There are many cases where hg wants to use a user-defined template with a given name, such as `ui.logtemplate` and `ui.mergemarkertemplate`. This patch starts moving such configs in a common section by moving `ui.logtemplate` to `command-templates.log` (with an alias from the old name, of course). Differential Revision: https://phab.mercurial-scm.org/D9245
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 23 Oct 2020 10:56:18 -0700
parents 5f0eeda2005d
children fc4fb2f17dd4
line wrap: on
line diff
--- a/tests/test-log.t	Mon Oct 26 10:08:22 2020 -0700
+++ b/tests/test-log.t	Fri Oct 23 10:56:18 2020 -0700
@@ -450,6 +450,16 @@
   a
   
   
+Respects ui.logtemplate and command-templates.log configs (the latter takes
+precedence)
+
+  $ hg log -r 0 --config ui.logtemplate="foo {rev}\n"
+  foo 0
+  $ hg log -r 0 --config command-templates.log="bar {rev}\n"
+  bar 0
+  $ hg log -r 0 --config ui.logtemplate="foo {rev}\n" \
+  > --config command-templates.log="bar {rev}\n"
+  bar 0
 
 
 -f and multiple filelog heads
@@ -1122,8 +1132,8 @@
   $ hg init follow-dup
   $ cd follow-dup
   $ cat <<EOF >> .hg/hgrc
-  > [ui]
-  > logtemplate = '=== {rev}: {desc}\n'
+  > [command-templates]
+  > log = '=== {rev}: {desc}\n'
   > [diff]
   > nodates = True
   > EOF