comparison mercurial/templatekw.py @ 38299:88e7105b5cd9

templater: restore the original string format of {date} Unfortunately, python-hglib relies on that. I could fix python-hglib, but there would be other tools that take a decimal separator as the separator of unixtime and tzoffset. The showfmt is set per instance since new code uses '%d %d' format by default.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 13 Jun 2018 21:57:24 +0900
parents 8d6109b49b31
children 523f64466a05
comparison
equal deleted inserted replaced
38298:af0e88e64ede 38299:88e7105b5cd9
238 238
239 @templatekeyword('date', requires={'ctx'}) 239 @templatekeyword('date', requires={'ctx'})
240 def showdate(context, mapping): 240 def showdate(context, mapping):
241 """Date information. The date when the changeset was committed.""" 241 """Date information. The date when the changeset was committed."""
242 ctx = context.resource(mapping, 'ctx') 242 ctx = context.resource(mapping, 'ctx')
243 return templateutil.date(ctx.date()) 243 # the default string format is '<float(unixtime)><tzoffset>' because
244 # python-hglib splits date at decimal separator.
245 return templateutil.date(ctx.date(), showfmt='%d.0%d')
244 246
245 @templatekeyword('desc', requires={'ctx'}) 247 @templatekeyword('desc', requires={'ctx'})
246 def showdescription(context, mapping): 248 def showdescription(context, mapping):
247 """String. The text of the changeset description.""" 249 """String. The text of the changeset description."""
248 ctx = context.resource(mapping, 'ctx') 250 ctx = context.resource(mapping, 'ctx')