changeset 45766:1f7c077e0640

config: rename ui.graphnodetemplate to command-templates.graphnode Differential Revision: https://phab.mercurial-scm.org/D9246
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 23 Oct 2020 15:27:33 -0700
parents ed84a4d48910
children 40411ad2f5d2
files mercurial/configitems.py mercurial/helptext/config.txt mercurial/logcmdutil.py tests/test-glog-beautifygraph.t tests/test-glog.t
diffstat 5 files changed, 29 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/configitems.py	Fri Oct 23 10:56:18 2020 -0700
+++ b/mercurial/configitems.py	Fri Oct 23 15:27:33 2020 -0700
@@ -224,6 +224,12 @@
     b'color', b'pagermode', default=dynamicdefault,
 )
 coreconfigitem(
+    b'command-templates',
+    b'graphnode',
+    default=None,
+    alias=[(b'ui', b'graphnodetemplate')],
+)
+coreconfigitem(
     b'command-templates', b'log', default=None, alias=[(b'ui', b'logtemplate')],
 )
 _registerdiffopts(section=b'commands', configprefix=b'commit.interactive.')
@@ -1291,9 +1297,6 @@
     b'ui', b'formatted', default=None,
 )
 coreconfigitem(
-    b'ui', b'graphnodetemplate', default=None,
-)
-coreconfigitem(
     b'ui', b'interactive', default=None,
 )
 coreconfigitem(
--- a/mercurial/helptext/config.txt	Fri Oct 23 10:56:18 2020 -0700
+++ b/mercurial/helptext/config.txt	Fri Oct 23 15:27:33 2020 -0700
@@ -2334,8 +2334,7 @@
     UTF-8. (default: ISO-8859-1)
 
 ``graphnodetemplate``
-    The template used to print changeset nodes in an ASCII revision graph.
-    (default: ``{graphnode}``)
+    (DEPRECATED) Use ``command-templates.graphnode`` instead.
 
 ``ignore``
     A file to read per-user ignore patterns from. This file should be
@@ -2566,6 +2565,10 @@
 
 Templates used for customizing the output of commands.
 
+``graphnode``
+    The template used to print changeset nodes in an ASCII revision graph.
+    (default: ``{graphnode}``)
+
 ``log``
     Template string for commands that print changesets.
 
--- a/mercurial/logcmdutil.py	Fri Oct 23 10:56:18 2020 -0700
+++ b/mercurial/logcmdutil.py	Fri Oct 23 15:27:33 2020 -0700
@@ -1111,7 +1111,7 @@
 
 
 def _graphnodeformatter(ui, displayer):
-    spec = ui.config(b'ui', b'graphnodetemplate')
+    spec = ui.config(b'command-templates', b'graphnode')
     if not spec:
         return templatekw.getgraphnode  # fast path for "{graphnode}"
 
--- a/tests/test-glog-beautifygraph.t	Fri Oct 23 10:56:18 2020 -0700
+++ b/tests/test-glog-beautifygraph.t	Fri Oct 23 15:27:33 2020 -0700
@@ -2534,7 +2534,7 @@
 
 node template with changesetprinter:
 
-  $ hg log -Gqr 5:7 --config ui.graphnodetemplate='"{rev}"'
+  $ hg log -Gqr 5:7 --config command-templates.graphnode='"{rev}"'
   7  7:9febbb9c8b2e
   \xe2\x94\x82 (esc)
   6    6:9feeac35a70a
@@ -2547,7 +2547,7 @@
 node template with changesettemplater (shared cache variable):
 
   $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \
-  > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}'
+  > --config command-templates.graphnode='{ifeq(latesttagdistance, 0, "#", graphnode)}'
   \xe2\x97\x8b  7 foo-bar+1 (esc)
   \xe2\x94\x82 (esc)
   #    6 foo-bar+0
@@ -2560,7 +2560,7 @@
 label() should just work in node template:
 
   $ hg log -Gqr 7 --config extensions.color= --color=debug \
-  > --config ui.graphnodetemplate='{label("branch.{branch}", rev)}'
+  > --config command-templates.graphnode='{label("branch.{branch}", rev)}'
   [branch.default\xe2\x94\x827]  [log.node|7:9febbb9c8b2e] (esc)
   \xe2\x94\x82 (esc)
   \xe2\x95\xa7 (esc)
--- a/tests/test-glog.t	Fri Oct 23 10:56:18 2020 -0700
+++ b/tests/test-glog.t	Fri Oct 23 15:27:33 2020 -0700
@@ -2384,6 +2384,18 @@
 
 node template with changesetprinter:
 
+  $ hg log -Gqr 5:7 --config command-templates.graphnode='"{rev}"'
+  7  7:9febbb9c8b2e
+  |
+  6    6:9feeac35a70a
+  |\
+  | ~
+  5  5:99b31f1c2782
+  |
+  ~
+
+node template with changesetprinter (legacy config):
+
   $ hg log -Gqr 5:7 --config ui.graphnodetemplate='"{rev}"'
   7  7:9febbb9c8b2e
   |
@@ -2397,7 +2409,7 @@
 node template with changesettemplater (shared cache variable):
 
   $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \
-  > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}'
+  > --config command-templates.graphnode='{ifeq(latesttagdistance, 0, "#", graphnode)}'
   o  7 foo-bar+1
   |
   #    6 foo-bar+0
@@ -2410,7 +2422,7 @@
 label() should just work in node template:
 
   $ hg log -Gqr 7 --config extensions.color= --color=debug \
-  > --config ui.graphnodetemplate='{label("branch.{branch}", rev)}'
+  > --config command-templates.graphnode='{label("branch.{branch}", rev)}'
   [branch.default|7]  [log.node|7:9febbb9c8b2e]
   |
   ~