Mercurial > hg
changeset 29678:2f3f18ad55a2
formatter: add function to convert date tuple to appropriate format
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 31 Jul 2016 17:07:29 +0900 |
parents | 69890b5dd32b |
children | e54bdd3aa23b |
files | mercurial/formatter.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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)