Patchwork D8847: templatespec: move check for non-unicode to lower-level function

login
register
mail settings
Submitter phabricator
Date July 29, 2020, 6:39 p.m.
Message ID <differential-rev-PHID-DREV-gk45gqq7xj5lgkab6tsw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46936/
State Superseded
Headers show

Comments

phabricator - July 29, 2020, 6:39 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Now that we have the factory functions, it makes sense to have the
  check there.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8847

AFFECTED FILES
  mercurial/formatter.py
  mercurial/logcmdutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -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)
 
 
diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -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)