##// END OF EJS Templates
templater: make date wrapper support dot/map operations...
Yuya Nishihara -
r38305:851fc9d4 default
parent child Browse files
Show More
@@ -172,7 +172,7 b' class wrappedvalue(wrapped):'
172 172 def tovalue(self, context, mapping):
173 173 return self._value
174 174
175 class date(wrapped):
175 class date(mappable, wrapped):
176 176 """Wrapper for date tuple"""
177 177
178 178 def __init__(self, value):
@@ -192,15 +192,15 b' class date(wrapped):'
192 192 def getmax(self, context, mapping):
193 193 raise error.ParseError(_('date is not iterable'))
194 194
195 def itermaps(self, context):
196 raise error.ParseError(_("date is not iterable"))
197
198 195 def join(self, context, mapping, sep):
199 196 raise error.ParseError(_("date is not iterable"))
200 197
201 198 def show(self, context, mapping):
202 199 return '%d %d' % (self._unixtime, self._tzoffset)
203 200
201 def tomap(self, context):
202 return {'unixtime': self._unixtime, 'tzoffset': self._tzoffset}
203
204 204 def tovalue(self, context, mapping):
205 205 return (self._unixtime, self._tzoffset)
206 206
@@ -3398,6 +3398,8 b' Test evaluation of dot operator:'
3398 3398 ce3cec86e6c26bd9bdfc590a6b92abc9680f1796
3399 3399 $ hg log -R latesttag -r0 -T '{extras.branch}\n'
3400 3400 default
3401 $ hg log -R latesttag -r0 -T '{date.unixtime} {localdate(date, "+0200").tzoffset}\n'
3402 0 -7200
3401 3403
3402 3404 $ hg log -R latesttag -l1 -T '{author.invalid}\n'
3403 3405 hg: parse error: 'test' is not a dictionary
General Comments 0
You need to be logged in to leave comments. Login now