Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG073bc922d349: py3: handle keyword arguments correctly in templater.py
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
if len(args) > 1: | if len(args) > 1: | ||||
# i18n: "latesttag" is a keyword | # i18n: "latesttag" is a keyword | ||||
raise error.ParseError(_("latesttag expects at most one argument")) | raise error.ParseError(_("latesttag expects at most one argument")) | ||||
pattern = None | pattern = None | ||||
if len(args) == 1: | if len(args) == 1: | ||||
pattern = evalstring(context, mapping, args[0]) | pattern = evalstring(context, mapping, args[0]) | ||||
return templatekw.showlatesttags(pattern, **mapping) | return templatekw.showlatesttags(pattern, **pycompat.strkwargs(mapping)) | ||||
@templatefunc('localdate(date[, tz])') | @templatefunc('localdate(date[, tz])') | ||||
def localdate(context, mapping, args): | def localdate(context, mapping, args): | ||||
"""Converts a date to the specified timezone. | """Converts a date to the specified timezone. | ||||
The default is local date.""" | The default is local date.""" | ||||
if not (1 <= len(args) <= 2): | if not (1 <= len(args) <= 2): | ||||
# i18n: "localdate" is a keyword | # i18n: "localdate" is a keyword | ||||
raise error.ParseError(_("localdate expects one or two arguments")) | raise error.ParseError(_("localdate expects one or two arguments")) | ||||
revsetcache = mapping['cache'].setdefault("revsetcache", {}) | revsetcache = mapping['cache'].setdefault("revsetcache", {}) | ||||
if raw in revsetcache: | if raw in revsetcache: | ||||
revs = revsetcache[raw] | revs = revsetcache[raw] | ||||
else: | else: | ||||
revs = query(raw) | revs = query(raw) | ||||
revs = list(revs) | revs = list(revs) | ||||
revsetcache[raw] = revs | revsetcache[raw] = revs | ||||
return templatekw.showrevslist("revision", revs, **mapping) | return templatekw.showrevslist("revision", revs, | ||||
**pycompat.strkwargs(mapping)) | |||||
@templatefunc('rstdoc(text, style)') | @templatefunc('rstdoc(text, style)') | ||||
def rstdoc(context, mapping, args): | def rstdoc(context, mapping, args): | ||||
"""Format reStructuredText.""" | """Format reStructuredText.""" | ||||
if len(args) != 2: | if len(args) != 2: | ||||
# i18n: "rstdoc" is a keyword | # i18n: "rstdoc" is a keyword | ||||
raise error.ParseError(_("rstdoc expects two arguments")) | raise error.ParseError(_("rstdoc expects two arguments")) | ||||