mercurial/templateutil.py
changeset 38310 88e7105b5cd9
parent 38301 f9c426385853
child 38452 b6294c113794
--- a/mercurial/templateutil.py	Tue Jun 12 20:43:56 2018 -0400
+++ b/mercurial/templateutil.py	Wed Jun 13 21:57:24 2018 +0900
@@ -190,10 +190,11 @@
 class date(mappable, wrapped):
     """Wrapper for date tuple"""
 
-    def __init__(self, value):
+    def __init__(self, value, showfmt='%d %d'):
         # value may be (float, int), but public interface shouldn't support
         # floating-point timestamp
         self._unixtime, self._tzoffset = map(int, value)
+        self._showfmt = showfmt
 
     def contains(self, context, mapping, item):
         raise error.ParseError(_('date is not iterable'))
@@ -211,7 +212,7 @@
         raise error.ParseError(_("date is not iterable"))
 
     def show(self, context, mapping):
-        return '%d %d' % (self._unixtime, self._tzoffset)
+        return self._showfmt % (self._unixtime, self._tzoffset)
 
     def tomap(self, context):
         return {'unixtime': self._unixtime, 'tzoffset': self._tzoffset}