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

login
register
mail settings
Submitter phabricator
Date Oct. 17, 2017, 2:56 a.m.
Message ID <differential-rev-PHID-DREV-46xxowgb5zii4rqp5shd-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25074/
State Superseded
Headers show

Comments

phabricator - Oct. 17, 2017, 2:56 a.m.
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




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 17, 2017, 12:39 p.m.
ryanmce accepted this revision.
ryanmce added a comment.
This revision is now accepted and ready to land.


  queued

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, ryanmce
Cc: ryanmce, mercurial-devel
phabricator - Oct. 17, 2017, 12:56 p.m.
yuja added a comment.


  pycompat.sysbytes() can be used here.

REPOSITORY
  rHG Mercurial

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

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

Patch

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)