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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

pulkit (Pulkit Goyal)
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

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)
 
 



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel