Mercurial > hg
changeset 32835:9d76812f9b0b
formatter: document lookuptemplate()
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 06 May 2017 16:24:21 +0900 |
parents | edde2e974ed0 |
children | 29558247b00e |
files | mercurial/cmdutil.py mercurial/formatter.py |
diffstat | 2 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Apr 22 15:30:27 2017 +0900 +++ b/mercurial/cmdutil.py Sat May 06 16:24:21 2017 +0900 @@ -1647,8 +1647,9 @@ self.t(self._parts['footer'], **props)) def _lookuplogtemplate(ui, tmpl, style): - """ - Find the template matching the given template spec or style. + """Find the template matching the given template spec or style + + See formatter.lookuptemplate() for details. """ # ui settings
--- a/mercurial/formatter.py Sat Apr 22 15:30:27 2017 +0900 +++ b/mercurial/formatter.py Sat May 06 16:24:21 2017 +0900 @@ -374,6 +374,21 @@ self._out.write(templater.stringify(g)) def lookuptemplate(ui, topic, tmpl): + """Find the template matching the given -T/--template spec 'tmpl' + + 'tmpl' can be any of the following: + + - a literal template (e.g. '{rev}') + - a map-file name or path (e.g. 'changelog') + - a reference to [templates] in config file + - a path to raw template file + + A map file defines a stand-alone template environment. If a map file + selected, all templates defined in the file will be loaded, and the + template matching the given topic will be rendered. No aliases will be + loaded from user config. + """ + # looks like a literal template? if '{' in tmpl: return tmpl, None