D1137: templater: don't blow up when trying to build an abort message

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Tue Oct 17 02:56:27 UTC 2017


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  __name__ is unicode, but we need bytes. For now, we'll make the
  (mostly-safe) assumption that template filter names will be ascii.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/templater.py

CHANGE DETAILS

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



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list