changeset 27892:83aef8d5bc1b

templater: make get(dict, key) return a single value This is necessary to obtain a _hybrid object from a dict. If get() yields a value, it would be stringified. I see no benefit to make get() lazy, so this patch just changes "yield" to "return".
author Yuya Nishihara <yuya@tcha.org>
date Sat, 16 Jan 2016 13:53:32 +0900
parents ac8c0ee5c3b8
children b42b2e86ef02
files mercurial/templater.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Sat Jan 16 13:42:37 2016 +0900
+++ b/mercurial/templater.py	Sat Jan 16 13:53:32 2016 +0900
@@ -432,7 +432,7 @@
         raise error.ParseError(_("get() expects a dict as first argument"))
 
     key = args[1][0](context, mapping, args[1][1])
-    yield dictarg.get(key)
+    return dictarg.get(key)
 
 def if_(context, mapping, args):
     """:if(expr, then[, else]): Conditionally execute based on the result of