mercurial/templater.py
changeset 31926 932241b8c644
parent 31922 0f41f1e3c75c
child 31927 2abc556dbe92
--- a/mercurial/templater.py	Wed Apr 05 22:28:09 2017 +0900
+++ b/mercurial/templater.py	Mon Apr 03 22:54:06 2017 +0900
@@ -532,6 +532,14 @@
         # i18n: "date" is a keyword
         raise error.ParseError(_("date expects a date information"))
 
+@templatefunc('dict([key=value...])', argspec='**kwargs')
+def dict_(context, mapping, args):
+    """Construct a dict from key-value pairs."""
+    data = util.sortdict()
+    data.update((k, evalfuncarg(context, mapping, v))
+                for k, v in args['kwargs'].iteritems())
+    return templatekw.hybriddict(data)
+
 @templatefunc('diff([includepattern [, excludepattern]])')
 def diff(context, mapping, args):
     """Show a diff, optionally