comparison mercurial/logcmdutil.py @ 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 c7413ffe0402
children 1f7c077e0640
comparison
equal deleted inserted replaced
45756:79d681753c4d 45765:ed84a4d48910
621 See formatter.lookuptemplate() for details. 621 See formatter.lookuptemplate() for details.
622 """ 622 """
623 623
624 # ui settings 624 # ui settings
625 if not tmpl and not style: # template are stronger than style 625 if not tmpl and not style: # template are stronger than style
626 tmpl = ui.config(b'ui', b'logtemplate') 626 tmpl = ui.config(b'command-templates', b'log')
627 if tmpl: 627 if tmpl:
628 return formatter.literal_templatespec(templater.unquotestring(tmpl)) 628 return formatter.literal_templatespec(templater.unquotestring(tmpl))
629 else: 629 else:
630 style = util.expandpath(ui.config(b'ui', b'style')) 630 style = util.expandpath(ui.config(b'ui', b'style'))
631 631
654 """show one changeset using template or regular display. 654 """show one changeset using template or regular display.
655 655
656 Display format will be the first non-empty hit of: 656 Display format will be the first non-empty hit of:
657 1. option 'template' 657 1. option 'template'
658 2. option 'style' 658 2. option 'style'
659 3. [ui] setting 'logtemplate' 659 3. [command-templates] setting 'log'
660 4. [ui] setting 'style' 660 4. [ui] setting 'style'
661 If all of these values are either the unset or the empty string, 661 If all of these values are either the unset or the empty string,
662 regular display via changesetprinter() is done. 662 regular display via changesetprinter() is done.
663 """ 663 """
664 postargs = (differ, opts, buffered) 664 postargs = (differ, opts, buffered)