Show More
@@ -437,12 +437,12 b' def get(context, mapping, args):' | |||||
437 | # i18n: "get" is a keyword |
|
437 | # i18n: "get" is a keyword | |
438 | raise error.ParseError(_("get() expects two arguments")) |
|
438 | raise error.ParseError(_("get() expects two arguments")) | |
439 |
|
439 | |||
440 |
dictarg = arg |
|
440 | dictarg = evalfuncarg(context, mapping, args[0]) | |
441 | if not util.safehasattr(dictarg, 'get'): |
|
441 | if not util.safehasattr(dictarg, 'get'): | |
442 | # i18n: "get" is a keyword |
|
442 | # i18n: "get" is a keyword | |
443 | raise error.ParseError(_("get() expects a dict as first argument")) |
|
443 | raise error.ParseError(_("get() expects a dict as first argument")) | |
444 |
|
444 | |||
445 |
key = arg |
|
445 | key = evalfuncarg(context, mapping, args[1]) | |
446 | return dictarg.get(key) |
|
446 | return dictarg.get(key) | |
447 |
|
447 | |||
448 | def if_(context, mapping, args): |
|
448 | def if_(context, mapping, args): |
@@ -3176,6 +3176,8 b' Test get function:' | |||||
3176 |
|
3176 | |||
3177 | $ hg log -r 0 --template '{get(extras, "branch")}\n' |
|
3177 | $ hg log -r 0 --template '{get(extras, "branch")}\n' | |
3178 | default |
|
3178 | default | |
|
3179 | $ hg log -r 0 --template '{get(extras, "br{"anch"}")}\n' | |||
|
3180 | default | |||
3179 | $ hg log -r 0 --template '{get(files, "should_fail")}\n' |
|
3181 | $ hg log -r 0 --template '{get(files, "should_fail")}\n' | |
3180 | hg: parse error: get() expects a dict as first argument |
|
3182 | hg: parse error: get() expects a dict as first argument | |
3181 | [255] |
|
3183 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now