[PATCH 3 of 3] keyword: use util.datestr for utcdate filter, make it accessable in variable

Christian Ebert blacktrash at gmx.net
Tue Aug 4 13:14:02 CDT 2009


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1249408979 -7200
# Node ID 2ff63ef629e0aee9f2d5875aca8725fb9d04ffd2
# Parent  013900f8fbfa1da320691ba01e53df5b7e86468e
keyword: use util.datestr for utcdate filter, make it accessable in variable

lambda syntax mimicking templatefilters.py

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -82,7 +82,7 @@
 from mercurial.lock import release
 from mercurial.node import nullid
 from mercurial.i18n import _
-import re, shutil, tempfile, time
+import re, shutil, tempfile
 
 commands.optionalrepo += ' kwdemo'
 
@@ -95,9 +95,8 @@
 # not when reading filelog, and unexpand when reading from working dir
 restricted = 'merge record resolve qfold qimport qnew qpush qrefresh qrecord'
 
-def utcdate(date):
-    '''Returns hgdate in cvs-like UTC format.'''
-    return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0]))
+# provide cvs-like UTC date filter
+utcdate = lambda x: util.datestr(x, '%Y/%m/%d %H:%M:%S')
 
 # make keyword tools accessible
 kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hg*']}


More information about the Mercurial-devel mailing list