Patchwork [4,of,7] templater: drop bool support from evalastype()

mail settings
Submitter Yuya Nishihara
Date March 25, 2018, 5:15 a.m.
Message ID <8b71d63fb9cc8c635fab.1521954951@mimosa>
Download mbox | patch
Permalink /patch/29841/
State Accepted
Headers show


Yuya Nishihara - March 25, 2018, 5:15 a.m.
# HG changeset patch
# User Yuya Nishihara <>
# Date 1521804235 -32400
#      Fri Mar 23 20:23:55 2018 +0900
# Node ID 8b71d63fb9cc8c635fab41b872b8db6d5279a58a
# Parent  63e4b6939689ee90bb27cd6522903bf44c349952
templater: drop bool support from evalastype()

Future patches will split evalastype() into two functions, evalrawexp()
and unwrapastype(), so we can catch the exception of type conversion.

  # evaluating function may bubble up inner ParseError
  thing = evalrawexp(context, mapping, arg)
      return unwrapastype(context, thing)
  except ParseError:
      # add hint and reraise

However, evalboolean() can't be factored out in this way since it has to
process boolean-like symbols as non keyword. Fortunately, it's unlikely
that we'll need a general type converter supporting bool, so this patch
drops it from the table.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -333,7 +333,6 @@  def evalstringliteral(context, mapping, 
     return stringify(thing)
 _evalfuncbytype = {
-    bool: evalboolean,
     bytes: evalstring,
     int: evalinteger,