##// END OF EJS Templates
keyword: declare input type of date filters as date...
Yuya Nishihara -
r37245:a0b17f74 default
parent child Browse files
Show More
@@ -109,6 +109,7 b' from mercurial import ('
109 registrar,
109 registrar,
110 scmutil,
110 scmutil,
111 templatefilters,
111 templatefilters,
112 templateutil,
112 util,
113 util,
113 )
114 )
114 from mercurial.utils import (
115 from mercurial.utils import (
@@ -156,27 +157,27 b" configitem('keywordset', 'svn',"
156 default=False,
157 default=False,
157 )
158 )
158 # date like in cvs' $Date
159 # date like in cvs' $Date
159 @templatefilter('utcdate')
160 @templatefilter('utcdate', intype=templateutil.date)
160 def utcdate(text):
161 def utcdate(date):
161 '''Date. Returns a UTC-date in this format: "2009/08/18 11:00:13".
162 '''Date. Returns a UTC-date in this format: "2009/08/18 11:00:13".
162 '''
163 '''
163 dateformat = '%Y/%m/%d %H:%M:%S'
164 dateformat = '%Y/%m/%d %H:%M:%S'
164 return dateutil.datestr((dateutil.parsedate(text)[0], 0), dateformat)
165 return dateutil.datestr((date[0], 0), dateformat)
165 # date like in svn's $Date
166 # date like in svn's $Date
166 @templatefilter('svnisodate')
167 @templatefilter('svnisodate', intype=templateutil.date)
167 def svnisodate(text):
168 def svnisodate(date):
168 '''Date. Returns a date in this format: "2009-08-18 13:00:13
169 '''Date. Returns a date in this format: "2009-08-18 13:00:13
169 +0200 (Tue, 18 Aug 2009)".
170 +0200 (Tue, 18 Aug 2009)".
170 '''
171 '''
171 return dateutil.datestr(text, '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)')
172 return dateutil.datestr(date, '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)')
172 # date like in svn's $Id
173 # date like in svn's $Id
173 @templatefilter('svnutcdate')
174 @templatefilter('svnutcdate', intype=templateutil.date)
174 def svnutcdate(text):
175 def svnutcdate(date):
175 '''Date. Returns a UTC-date in this format: "2009-08-18
176 '''Date. Returns a UTC-date in this format: "2009-08-18
176 11:00:13Z".
177 11:00:13Z".
177 '''
178 '''
178 dateformat = '%Y-%m-%d %H:%M:%SZ'
179 dateformat = '%Y-%m-%d %H:%M:%SZ'
179 return dateutil.datestr((dateutil.parsedate(text)[0], 0), dateformat)
180 return dateutil.datestr((date[0], 0), dateformat)
180
181
181 # make keyword tools accessible
182 # make keyword tools accessible
182 kwtools = {'hgcmd': ''}
183 kwtools = {'hgcmd': ''}
General Comments 0
You need to be logged in to leave comments. Login now