Show More
@@ -104,6 +104,7 b' from mercurial import (' | |||||
104 | match, |
|
104 | match, | |
105 | patch, |
|
105 | patch, | |
106 | pathutil, |
|
106 | pathutil, | |
|
107 | registrar, | |||
107 | scmutil, |
|
108 | scmutil, | |
108 | templatefilters, |
|
109 | templatefilters, | |
109 | util, |
|
110 | util, | |
@@ -137,28 +138,29 b' colortable = {' | |||||
137 | 'kwfiles.ignoredunknown': 'none' |
|
138 | 'kwfiles.ignoredunknown': 'none' | |
138 | } |
|
139 | } | |
139 |
|
140 | |||
|
141 | templatefilter = registrar.templatefilter() | |||
|
142 | ||||
140 | # date like in cvs' $Date |
|
143 | # date like in cvs' $Date | |
|
144 | @templatefilter('utcdate') | |||
141 | def utcdate(text): |
|
145 | def utcdate(text): | |
142 |
''' |
|
146 | '''Date. Returns a UTC-date in this format: "2009/08/18 11:00:13". | |
143 | ''' |
|
147 | ''' | |
144 | return util.datestr((util.parsedate(text)[0], 0), '%Y/%m/%d %H:%M:%S') |
|
148 | return util.datestr((util.parsedate(text)[0], 0), '%Y/%m/%d %H:%M:%S') | |
145 | # date like in svn's $Date |
|
149 | # date like in svn's $Date | |
|
150 | @templatefilter('svnisodate') | |||
146 | def svnisodate(text): |
|
151 | def svnisodate(text): | |
147 |
''' |
|
152 | '''Date. Returns a date in this format: "2009-08-18 13:00:13 | |
148 | +0200 (Tue, 18 Aug 2009)". |
|
153 | +0200 (Tue, 18 Aug 2009)". | |
149 | ''' |
|
154 | ''' | |
150 | return util.datestr(text, '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)') |
|
155 | return util.datestr(text, '%Y-%m-%d %H:%M:%S %1%2 (%a, %d %b %Y)') | |
151 | # date like in svn's $Id |
|
156 | # date like in svn's $Id | |
|
157 | @templatefilter('svnutcdate') | |||
152 | def svnutcdate(text): |
|
158 | def svnutcdate(text): | |
153 |
''' |
|
159 | '''Date. Returns a UTC-date in this format: "2009-08-18 | |
154 | 11:00:13Z". |
|
160 | 11:00:13Z". | |
155 | ''' |
|
161 | ''' | |
156 | return util.datestr((util.parsedate(text)[0], 0), '%Y-%m-%d %H:%M:%SZ') |
|
162 | return util.datestr((util.parsedate(text)[0], 0), '%Y-%m-%d %H:%M:%SZ') | |
157 |
|
163 | |||
158 | templatefilters.filters.update({'utcdate': utcdate, |
|
|||
159 | 'svnisodate': svnisodate, |
|
|||
160 | 'svnutcdate': svnutcdate}) |
|
|||
161 |
|
||||
162 | # make keyword tools accessible |
|
164 | # make keyword tools accessible | |
163 | kwtools = {'templater': None, 'hgcmd': ''} |
|
165 | kwtools = {'templater': None, 'hgcmd': ''} | |
164 |
|
166 |
@@ -51,6 +51,31 b' as it would succeed without uisetup othe' | |||||
51 | Branch = {branches} |
|
51 | Branch = {branches} | |
52 | $Branch: demobranch $ |
|
52 | $Branch: demobranch $ | |
53 |
|
53 | |||
|
54 | (test template filter svnisodate and svnutcdate) | |||
|
55 | ||||
|
56 | $ hg --quiet kwdemo --config keywordset.svn=True | |||
|
57 | [extensions] | |||
|
58 | keyword = | |||
|
59 | [keyword] | |||
|
60 | demo.txt = | |||
|
61 | [keywordset] | |||
|
62 | svn = True | |||
|
63 | [keywordmaps] | |||
|
64 | Author = {author|user} | |||
|
65 | Date = {date|svnisodate} | |||
|
66 | Id = {file|basename},v {node|short} {date|svnutcdate} {author|user} | |||
|
67 | LastChangedBy = {author|user} | |||
|
68 | LastChangedDate = {date|svnisodate} | |||
|
69 | LastChangedRevision = {node|short} | |||
|
70 | Revision = {node|short} | |||
|
71 | $Author: test $ | |||
|
72 | $Date: ????-??-?? ??:??:?? ????? (???, ?? ??? ????) $ (glob) | |||
|
73 | $Id: demo.txt,v ???????????? ????-??-?? ??:??:??Z test $ (glob) | |||
|
74 | $LastChangedBy: test $ | |||
|
75 | $LastChangedDate: ????-??-?? ??:??:?? ????? (???, ?? ??? ????) $ (glob) | |||
|
76 | $LastChangedRevision: ???????????? $ (glob) | |||
|
77 | $Revision: ???????????? $ (glob) | |||
|
78 | ||||
54 |
$ |
|
79 | $ cat <<EOF >> $HGRCPATH | |
55 | > [keyword] |
|
80 | > [keyword] | |
56 | > ** = |
|
81 | > ** = |
General Comments 0
You need to be logged in to leave comments.
Login now