changeset 45266:215f08c8006c

templatespec: move check for non-unicode to lower-level function Now that we have the factory functions, it makes sense to have the check there. Differential Revision: https://phab.mercurial-scm.org/D8847
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 20 Jul 2020 21:33:28 -0700
parents dfb67cd1da7f
children c1915cfa8080
files mercurial/formatter.py mercurial/logcmdutil.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/formatter.py	Mon Jul 20 21:32:10 2020 -0700
+++ b/mercurial/formatter.py	Mon Jul 20 21:33:28 2020 -0700
@@ -551,6 +551,8 @@
 
 
 def literal_templatespec(tmpl):
+    if pycompat.ispy3:
+        assert not isinstance(tmpl, str), b'tmpl must not be a str'
     return templatespec(b'', tmpl, None)
 
 
--- a/mercurial/logcmdutil.py	Mon Jul 20 21:32:10 2020 -0700
+++ b/mercurial/logcmdutil.py	Mon Jul 20 21:33:28 2020 -0700
@@ -607,8 +607,6 @@
     if mapfile:
         return formatter.mapfile_templatespec(b'changeset', mapfile)
     else:
-        if pycompat.ispy3:
-            assert not isinstance(tmpl, str), b'tmpl must not be a str'
         return formatter.literal_templatespec(tmpl)