# HG changeset patch # User Christian Ebert # Date 1249485512 -7200 # Node ID d41074cb161bf42bcd63c93f7ef1c59ae6ec51c8 # Parent 439e096ce144ebd0a0e5ad82524ca7c92616c8c0 (0.9.2compat) prefer util.datestr over time module import We keep the function in this branch to catch the TypeError. diff -r 439e096ce144 -r d41074cb161b hgkw/keyword.py --- a/hgkw/keyword.py Wed Aug 05 17:01:55 2009 +0200 +++ b/hgkw/keyword.py Wed Aug 05 17:18:32 2009 +0200 @@ -90,7 +90,7 @@ from mercurial import localrepo, patch, revlog, templater, util from mercurial.node import nullid, hex from mercurial.i18n import gettext as _ -import getopt, os, re, shutil, tempfile, time +import getopt, os, re, shutil, tempfile commands.optionalrepo += ' kwdemo' @@ -103,9 +103,12 @@ # not when reading filelog, and unexpand when reading from working dir restricted = 'merge record resolve qfold qimport qnew qpush qrefresh qrecord' +# provide cvs-like UTC date filter def utcdate(date): - '''Returns hgdate in cvs-like UTC format.''' - return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0])) + try: + return util.datestr(date, '%Y/%m/%d %H:%M:%S', False) + except TypeError: + return util.datestr(date, '%Y/%m/%d %H:%M:%S') def textsafe(s): '''Safe version of util.binary with reversed logic.