Mercurial > hg
changeset 37161:0023da2910c9
templater: extract type conversion from evalfuncarg()
Needed by the subsequent patches.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 23 Mar 2018 21:03:21 +0900 |
parents | 53e6b7e05553 |
children | 9ab3491f84c2 |
files | mercurial/templateutil.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/templateutil.py Fri Mar 23 20:23:55 2018 +0900 +++ b/mercurial/templateutil.py Fri Mar 23 21:03:21 2018 +0900 @@ -287,7 +287,12 @@ def evalfuncarg(context, mapping, arg): """Evaluate given argument as value type""" - thing = evalrawexp(context, mapping, arg) + return _unwrapvalue(evalrawexp(context, mapping, arg)) + +# TODO: unify this with unwrapvalue() once the bug of templatefunc.join() +# is fixed. we can't do that right now because join() has to take a generator +# of byte strings as it is, not a lazy byte string. +def _unwrapvalue(thing): thing = unwrapvalue(thing) # evalrawexp() may return string, generator of strings or arbitrary object # such as date tuple, but filter does not want generator.