templater: don't blow up when trying to build an abort message
authorAugie Fackler <augie@google.com>
Mon, 16 Oct 2017 22:50:39 -0400
changeset 34808 e87e62b7fc0b
parent 34807 3caec3c032c8
child 34809 3a65012be661
templater: don't blow up when trying to build an abort message __name__ is unicode, but we need bytes. For now, we'll make the (mostly-safe) assumption that template filter names will be ascii. Differential Revision: https://phab.mercurial-scm.org/D1137
mercurial/templater.py
--- a/mercurial/templater.py	Mon Oct 16 22:44:06 2017 -0400
+++ b/mercurial/templater.py	Mon Oct 16 22:50:39 2017 -0400
@@ -427,7 +427,7 @@
         sym = findsymbolicname(arg)
         if sym:
             msg = (_("template filter '%s' is not compatible with keyword '%s'")
-                   % (filt.__name__, sym))
+                   % (filt.__name__.encode('ascii'), sym))
         else:
             msg = _("incompatible use of template filter '%s'") % filt.__name__
         raise error.Abort(msg)