Patchwork D9246: config: rename ui.graphnodetemplate to command-templates.graphnode

login
register
mail settings
Submitter phabricator
Date Oct. 24, 2020, 1 a.m.
Message ID <differential-rev-PHID-DREV-sfdpywzv365wbkojvwki-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47517/
State Superseded
Headers show

Comments

phabricator - Oct. 24, 2020, 1 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/helptext/config.txt
  mercurial/logcmdutil.py
  tests/test-glog-beautifygraph.t
  tests/test-glog.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -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]
   |
   ~
diff --git a/tests/test-glog-beautifygraph.t b/tests/test-glog-beautifygraph.t
--- a/tests/test-glog-beautifygraph.t
+++ b/tests/test-glog-beautifygraph.t
@@ -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)
diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -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}"
 
diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
--- a/mercurial/helptext/config.txt
+++ b/mercurial/helptext/config.txt
@@ -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.
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -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(