# HG changeset patch # User Yuya Nishihara <y...@tcha.org> # Date 1521382461 -32400 # Sun Mar 18 23:14:21 2018 +0900 # Node ID d7a44391a574f6526d4d14925abe1dce048a83e3 # Parent cc616e233d253af1aeb4cc2576a38a437c3be95a templater: pass context down to unwrapvalue()
The same reason as why I made unwraphybrid() take a context. diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py +++ b/mercurial/templatefuncs.py @@ -318,7 +318,7 @@ def join(context, mapping, args): # TODO: perhaps this should be evalfuncarg(), but it can't because hgweb # abuses generator as a keyword that returns a list of dicts. joinset = evalrawexp(context, mapping, args[0]) - joinset = templateutil.unwrapvalue(joinset) + joinset = templateutil.unwrapvalue(context, joinset) joinfmt = getattr(joinset, 'joinfmt', pycompat.identity) joiner = " " if len(args) > 1: diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -152,7 +152,7 @@ def unwraphybrid(context, thing): return thing return thing.show(context) -def unwrapvalue(thing): +def unwrapvalue(context, thing): """Move the inner value object out of the wrapper""" if not util.safehasattr(thing, '_value'): return thing @@ -322,7 +322,7 @@ def evalfuncarg(context, mapping, arg): # 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(context, thing): - thing = unwrapvalue(thing) + thing = unwrapvalue(context, thing) # evalrawexp() may return string, generator of strings or arbitrary object # such as date tuple, but filter does not want generator. if isinstance(thing, types.GeneratorType): @@ -339,7 +339,7 @@ def evalboolean(context, mapping, arg): thing = stringutil.parsebool(data) else: thing = func(context, mapping, data) - thing = unwrapvalue(thing) + thing = unwrapvalue(context, thing) if isinstance(thing, bool): return thing # other objects are evaluated as strings, which means 0 is True, but _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel