Mercurial > public > mercurial-scm > hg
comparison mercurial/logcmdutil.py @ 45265:dfb67cd1da7f
templatespec: logcmdutil.templatespec() gets either template or mapfile
The callers of the function already never pass (non-`None`) values for
both, so let's check that and call the new factory functions.
Differential Revision: https://phab.mercurial-scm.org/D8846
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 20 Jul 2020 21:32:10 -0700 |
parents | 3b7aabd02e11 |
children | 215f08c8006c |
comparison
equal
deleted
inserted
replaced
45264:8cce9f77ca73 | 45265:dfb67cd1da7f |
---|---|
601 if not self.footer: | 601 if not self.footer: |
602 self.footer = self.t.render(self._parts[b'footer'], props) | 602 self.footer = self.t.render(self._parts[b'footer'], props) |
603 | 603 |
604 | 604 |
605 def templatespec(tmpl, mapfile): | 605 def templatespec(tmpl, mapfile): |
606 if pycompat.ispy3: | 606 assert not (tmpl and mapfile) |
607 assert not isinstance(tmpl, str), b'tmpl must not be a str' | |
608 if mapfile: | 607 if mapfile: |
609 return formatter.templatespec(b'changeset', tmpl, mapfile) | 608 return formatter.mapfile_templatespec(b'changeset', mapfile) |
610 else: | 609 else: |
611 return formatter.templatespec(b'', tmpl, None) | 610 if pycompat.ispy3: |
611 assert not isinstance(tmpl, str), b'tmpl must not be a str' | |
612 return formatter.literal_templatespec(tmpl) | |
612 | 613 |
613 | 614 |
614 def _lookuptemplate(ui, tmpl, style): | 615 def _lookuptemplate(ui, tmpl, style): |
615 """Find the template matching the given template spec or style | 616 """Find the template matching the given template spec or style |
616 | 617 |