Mercurial > hg
comparison mercurial/templater.py @ 28334:9dc340f51e06
templater: make date() use helper function to evaluate argument
A date argument should never be a generator, but using evalfuncarg() should
be good for consistency.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 14 Feb 2016 13:36:50 +0900 |
parents | 41373244f4e5 |
children | a6c2310b3827 |
comparison
equal
deleted
inserted
replaced
28333:41373244f4e5 | 28334:9dc340f51e06 |
---|---|
327 "Mon Sep 04 15:13:13 2006 0700".""" | 327 "Mon Sep 04 15:13:13 2006 0700".""" |
328 if not (1 <= len(args) <= 2): | 328 if not (1 <= len(args) <= 2): |
329 # i18n: "date" is a keyword | 329 # i18n: "date" is a keyword |
330 raise error.ParseError(_("date expects one or two arguments")) | 330 raise error.ParseError(_("date expects one or two arguments")) |
331 | 331 |
332 date = args[0][0](context, mapping, args[0][1]) | 332 date = evalfuncarg(context, mapping, args[0]) |
333 fmt = None | 333 fmt = None |
334 if len(args) == 2: | 334 if len(args) == 2: |
335 fmt = stringify(args[1][0](context, mapping, args[1][1])) | 335 fmt = stringify(args[1][0](context, mapping, args[1][1])) |
336 try: | 336 try: |
337 if fmt is None: | 337 if fmt is None: |