changeset 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 8cce9f77ca73
children 215f08c8006c
files mercurial/logcmdutil.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/logcmdutil.py	Thu Jul 16 13:33:46 2020 -0700
+++ b/mercurial/logcmdutil.py	Mon Jul 20 21:32:10 2020 -0700
@@ -603,12 +603,13 @@
 
 
 def templatespec(tmpl, mapfile):
-    if pycompat.ispy3:
-        assert not isinstance(tmpl, str), b'tmpl must not be a str'
+    assert not (tmpl and mapfile)
     if mapfile:
-        return formatter.templatespec(b'changeset', tmpl, mapfile)
+        return formatter.mapfile_templatespec(b'changeset', mapfile)
     else:
-        return formatter.templatespec(b'', tmpl, None)
+        if pycompat.ispy3:
+            assert not isinstance(tmpl, str), b'tmpl must not be a str'
+        return formatter.literal_templatespec(tmpl)
 
 
 def _lookuptemplate(ui, tmpl, style):