# HG changeset patch # User Yuya Nishihara # Date 1469952449 -32400 # Node ID 2f3f18ad55a2b249bc0d1b3b49f0ed0929f7b729 # Parent 69890b5dd32b760bb36cb8d9392a8ba6cf75a575 formatter: add function to convert date tuple to appropriate format diff -r 69890b5dd32b -r 2f3f18ad55a2 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)