formatter: add function to convert date tuple to appropriate format
authorYuya Nishihara <yuya@tcha.org>
Sun, 31 Jul 2016 17:07:29 +0900
changeset 29678 2f3f18ad55a2
parent 29677 69890b5dd32b
child 29679 e54bdd3aa23b
formatter: add function to convert date tuple to appropriate format
mercurial/formatter.py
--- a/mercurial/formatter.py	Sun Jul 31 16:56:26 2016 +0900
+++ b/mercurial/formatter.py	Sun Jul 31 17:07:29 2016 +0900
@@ -47,6 +47,10 @@
             self._showitem()
         self._item = {}
     @staticmethod
+    def formatdate(date, fmt='%a %b %d %H:%M:%S %Y %1%2'):
+        '''convert date tuple to appropriate format'''
+        return date
+    @staticmethod
     def formatlist(data, name, fmt='%s', sep=' '):
         '''convert iterable to appropriate list format'''
         return list(data)
@@ -84,6 +88,10 @@
     def startitem(self):
         pass
     @staticmethod
+    def formatdate(date, fmt='%a %b %d %H:%M:%S %Y %1%2'):
+        '''stringify date tuple in the given format'''
+        return util.datestr(date, fmt)
+    @staticmethod
     def formatlist(data, name, fmt='%s', sep=' '):
         '''stringify iterable separated by sep'''
         return sep.join(fmt % e for e in data)