[PATCH 4 of 7] templater: drop bool support from evalastype()
Yuya Nishihara
yuya at tcha.org
Sun Mar 25 05:15:51 UTC 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# 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)
try:
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/templateutil.py b/mercurial/templateutil.py
--- a/mercurial/templateutil.py
+++ b/mercurial/templateutil.py
@@ -333,7 +333,6 @@ def evalstringliteral(context, mapping,
return stringify(thing)
_evalfuncbytype = {
- bool: evalboolean,
bytes: evalstring,
int: evalinteger,
}
More information about the Mercurial-devel
mailing list