Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 32893:c8f2cf18b82e
formatter: load templates section like a map file
Since a map file has another level to select a template (spec -> mapfile
-> topic), this isn't exactly the same as how a map file works. But I believe
most users would expect the new behavior.
A literal template is stored as an unnamed template so that it will never
conflict with the templates defined in [templates] section.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 22 Apr 2017 20:14:55 +0900 |
parents | 2ecce24dfcd3 |
children | 388e1242ed9e |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat May 06 17:41:05 2017 +0900 +++ b/mercurial/cmdutil.py Sat Apr 22 20:14:55 2017 +0900 @@ -1649,7 +1649,10 @@ self.t(self._parts['footer'], **props)) def logtemplatespec(tmpl, mapfile): - return formatter.templatespec('changeset', tmpl, mapfile) + if mapfile: + return formatter.templatespec('changeset', tmpl, mapfile) + else: + return formatter.templatespec('', tmpl, None) def _lookuplogtemplate(ui, tmpl, style): """Find the template matching the given template spec or style @@ -1706,7 +1709,7 @@ spec = _lookuplogtemplate(ui, opts.get('template'), opts.get('style')) - if not spec.tmpl and not spec.mapfile: + if not spec.ref and not spec.tmpl and not spec.mapfile: return changeset_printer(ui, repo, matchfn, opts, buffered) return changeset_templater(ui, repo, spec, matchfn, opts, buffered)