Show More
@@ -52,8 +52,11 b' For [keywordmaps] template mapping and e' | |||||
52 | control run :hg:`kwdemo`. See :hg:`help templates` for a list of |
|
52 | control run :hg:`kwdemo`. See :hg:`help templates` for a list of | |
53 | available templates and filters. |
|
53 | available templates and filters. | |
54 |
|
54 | |||
55 |
|
|
55 | Three additional date template filters are provided:: | |
56 | returns a date like "2006/09/18 15:13:13". |
|
56 | ||
|
57 | utcdate "2006/09/18 15:13:13" | |||
|
58 | svnutcdate "2006-09-18 15:13:13Z" | |||
|
59 | svnisodate "2006-09-18 08:13:13 -700 (Mon, 18 Sep 2006)" | |||
57 |
|
60 | |||
58 | The default template mappings (view with :hg:`kwdemo -d`) can be |
|
61 | The default template mappings (view with :hg:`kwdemo -d`) can be | |
59 | replaced with customized keywords and templates. Again, run |
|
62 | replaced with customized keywords and templates. Again, run | |
@@ -94,8 +97,12 b" recordcommands = 'record qrecord'" | |||||
94 | # names of extensions using dorecord |
|
97 | # names of extensions using dorecord | |
95 | recordextensions = 'record' |
|
98 | recordextensions = 'record' | |
96 |
|
99 | |||
97 | # provide cvs-like UTC date filter |
|
100 | # date like in cvs' $Date | |
98 | utcdate = lambda x: util.datestr((x[0], 0), '%Y/%m/%d %H:%M:%S') |
|
101 | utcdate = lambda x: util.datestr((x[0], 0), '%Y/%m/%d %H:%M:%S') | |
|
102 | # date like in svn's $Date | |||
|
103 | svnisodate = lambda x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)') | |||
|
104 | # date like in svn's $Id | |||
|
105 | svnutcdate = lambda x: util.datestr((x[0], 0), '%Y-%m-%d %H:%M:%SZ') | |||
99 |
|
106 | |||
100 | # make keyword tools accessible |
|
107 | # make keyword tools accessible | |
101 | kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hg*']} |
|
108 | kwtools = {'templater': None, 'hgcmd': '', 'inc': [], 'exc': ['.hg*']} | |
@@ -135,6 +142,8 b' class kwtemplater(object):' | |||||
135 | self.re_kw = re.compile(kwpat) |
|
142 | self.re_kw = re.compile(kwpat) | |
136 |
|
143 | |||
137 | templatefilters.filters['utcdate'] = utcdate |
|
144 | templatefilters.filters['utcdate'] = utcdate | |
|
145 | templatefilters.filters['svnisodate'] = svnisodate | |||
|
146 | templatefilters.filters['svnutcdate'] = svnutcdate | |||
138 |
|
147 | |||
139 | def substitute(self, data, path, ctx, subfunc): |
|
148 | def substitute(self, data, path, ctx, subfunc): | |
140 | '''Replaces keywords in data with expanded template.''' |
|
149 | '''Replaces keywords in data with expanded template.''' |
General Comments 0
You need to be logged in to leave comments.
Login now