##// END OF EJS Templates
template: modify showextras to return a hybrid...
Matthew Turk -
r20183:de7e6c48 default
parent child Browse files
Show More
@@ -1,397 +1,399
1 # templatekw.py - common changeset template keywords
1 # templatekw.py - common changeset template keywords
2 #
2 #
3 # Copyright 2005-2009 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2009 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from node import hex
8 from node import hex
9 import patch, util, error
9 import patch, util, error
10 import hbisect
10 import hbisect
11
11
12 # This helper class allows us to handle both:
12 # This helper class allows us to handle both:
13 # "{files}" (legacy command-line-specific list hack) and
13 # "{files}" (legacy command-line-specific list hack) and
14 # "{files % '{file}\n'}" (hgweb-style with inlining and function support)
14 # "{files % '{file}\n'}" (hgweb-style with inlining and function support)
15
15
16 class _hybrid(object):
16 class _hybrid(object):
17 def __init__(self, gen, values, joinfmt=None):
17 def __init__(self, gen, values, joinfmt=None):
18 self.gen = gen
18 self.gen = gen
19 self.values = values
19 self.values = values
20 if joinfmt:
20 if joinfmt:
21 self.joinfmt = joinfmt
21 self.joinfmt = joinfmt
22 else:
22 else:
23 self.joinfmt = lambda x: x.values()[0]
23 self.joinfmt = lambda x: x.values()[0]
24 def __iter__(self):
24 def __iter__(self):
25 return self.gen
25 return self.gen
26 def __call__(self):
26 def __call__(self):
27 for x in self.values:
27 for x in self.values:
28 yield x
28 yield x
29
29
30 def showlist(name, values, plural=None, element=None, **args):
30 def showlist(name, values, plural=None, element=None, **args):
31 if not element:
31 if not element:
32 element = name
32 element = name
33 f = _showlist(name, values, plural, **args)
33 f = _showlist(name, values, plural, **args)
34 return _hybrid(f, [{element: x} for x in values])
34 return _hybrid(f, [{element: x} for x in values])
35
35
36 def _showlist(name, values, plural=None, **args):
36 def _showlist(name, values, plural=None, **args):
37 '''expand set of values.
37 '''expand set of values.
38 name is name of key in template map.
38 name is name of key in template map.
39 values is list of strings or dicts.
39 values is list of strings or dicts.
40 plural is plural of name, if not simply name + 's'.
40 plural is plural of name, if not simply name + 's'.
41
41
42 expansion works like this, given name 'foo'.
42 expansion works like this, given name 'foo'.
43
43
44 if values is empty, expand 'no_foos'.
44 if values is empty, expand 'no_foos'.
45
45
46 if 'foo' not in template map, return values as a string,
46 if 'foo' not in template map, return values as a string,
47 joined by space.
47 joined by space.
48
48
49 expand 'start_foos'.
49 expand 'start_foos'.
50
50
51 for each value, expand 'foo'. if 'last_foo' in template
51 for each value, expand 'foo'. if 'last_foo' in template
52 map, expand it instead of 'foo' for last key.
52 map, expand it instead of 'foo' for last key.
53
53
54 expand 'end_foos'.
54 expand 'end_foos'.
55 '''
55 '''
56 templ = args['templ']
56 templ = args['templ']
57 if plural:
57 if plural:
58 names = plural
58 names = plural
59 else: names = name + 's'
59 else: names = name + 's'
60 if not values:
60 if not values:
61 noname = 'no_' + names
61 noname = 'no_' + names
62 if noname in templ:
62 if noname in templ:
63 yield templ(noname, **args)
63 yield templ(noname, **args)
64 return
64 return
65 if name not in templ:
65 if name not in templ:
66 if isinstance(values[0], str):
66 if isinstance(values[0], str):
67 yield ' '.join(values)
67 yield ' '.join(values)
68 else:
68 else:
69 for v in values:
69 for v in values:
70 yield dict(v, **args)
70 yield dict(v, **args)
71 return
71 return
72 startname = 'start_' + names
72 startname = 'start_' + names
73 if startname in templ:
73 if startname in templ:
74 yield templ(startname, **args)
74 yield templ(startname, **args)
75 vargs = args.copy()
75 vargs = args.copy()
76 def one(v, tag=name):
76 def one(v, tag=name):
77 try:
77 try:
78 vargs.update(v)
78 vargs.update(v)
79 except (AttributeError, ValueError):
79 except (AttributeError, ValueError):
80 try:
80 try:
81 for a, b in v:
81 for a, b in v:
82 vargs[a] = b
82 vargs[a] = b
83 except ValueError:
83 except ValueError:
84 vargs[name] = v
84 vargs[name] = v
85 return templ(tag, **vargs)
85 return templ(tag, **vargs)
86 lastname = 'last_' + name
86 lastname = 'last_' + name
87 if lastname in templ:
87 if lastname in templ:
88 last = values.pop()
88 last = values.pop()
89 else:
89 else:
90 last = None
90 last = None
91 for v in values:
91 for v in values:
92 yield one(v)
92 yield one(v)
93 if last is not None:
93 if last is not None:
94 yield one(last, tag=lastname)
94 yield one(last, tag=lastname)
95 endname = 'end_' + names
95 endname = 'end_' + names
96 if endname in templ:
96 if endname in templ:
97 yield templ(endname, **args)
97 yield templ(endname, **args)
98
98
99 def getfiles(repo, ctx, revcache):
99 def getfiles(repo, ctx, revcache):
100 if 'files' not in revcache:
100 if 'files' not in revcache:
101 revcache['files'] = repo.status(ctx.p1().node(), ctx.node())[:3]
101 revcache['files'] = repo.status(ctx.p1().node(), ctx.node())[:3]
102 return revcache['files']
102 return revcache['files']
103
103
104 def getlatesttags(repo, ctx, cache):
104 def getlatesttags(repo, ctx, cache):
105 '''return date, distance and name for the latest tag of rev'''
105 '''return date, distance and name for the latest tag of rev'''
106
106
107 if 'latesttags' not in cache:
107 if 'latesttags' not in cache:
108 # Cache mapping from rev to a tuple with tag date, tag
108 # Cache mapping from rev to a tuple with tag date, tag
109 # distance and tag name
109 # distance and tag name
110 cache['latesttags'] = {-1: (0, 0, 'null')}
110 cache['latesttags'] = {-1: (0, 0, 'null')}
111 latesttags = cache['latesttags']
111 latesttags = cache['latesttags']
112
112
113 rev = ctx.rev()
113 rev = ctx.rev()
114 todo = [rev]
114 todo = [rev]
115 while todo:
115 while todo:
116 rev = todo.pop()
116 rev = todo.pop()
117 if rev in latesttags:
117 if rev in latesttags:
118 continue
118 continue
119 ctx = repo[rev]
119 ctx = repo[rev]
120 tags = [t for t in ctx.tags() if repo.tagtype(t) == 'global']
120 tags = [t for t in ctx.tags() if repo.tagtype(t) == 'global']
121 if tags:
121 if tags:
122 latesttags[rev] = ctx.date()[0], 0, ':'.join(sorted(tags))
122 latesttags[rev] = ctx.date()[0], 0, ':'.join(sorted(tags))
123 continue
123 continue
124 try:
124 try:
125 # The tuples are laid out so the right one can be found by
125 # The tuples are laid out so the right one can be found by
126 # comparison.
126 # comparison.
127 pdate, pdist, ptag = max(
127 pdate, pdist, ptag = max(
128 latesttags[p.rev()] for p in ctx.parents())
128 latesttags[p.rev()] for p in ctx.parents())
129 except KeyError:
129 except KeyError:
130 # Cache miss - recurse
130 # Cache miss - recurse
131 todo.append(rev)
131 todo.append(rev)
132 todo.extend(p.rev() for p in ctx.parents())
132 todo.extend(p.rev() for p in ctx.parents())
133 continue
133 continue
134 latesttags[rev] = pdate, pdist + 1, ptag
134 latesttags[rev] = pdate, pdist + 1, ptag
135 return latesttags[rev]
135 return latesttags[rev]
136
136
137 def getrenamedfn(repo, endrev=None):
137 def getrenamedfn(repo, endrev=None):
138 rcache = {}
138 rcache = {}
139 if endrev is None:
139 if endrev is None:
140 endrev = len(repo)
140 endrev = len(repo)
141
141
142 def getrenamed(fn, rev):
142 def getrenamed(fn, rev):
143 '''looks up all renames for a file (up to endrev) the first
143 '''looks up all renames for a file (up to endrev) the first
144 time the file is given. It indexes on the changerev and only
144 time the file is given. It indexes on the changerev and only
145 parses the manifest if linkrev != changerev.
145 parses the manifest if linkrev != changerev.
146 Returns rename info for fn at changerev rev.'''
146 Returns rename info for fn at changerev rev.'''
147 if fn not in rcache:
147 if fn not in rcache:
148 rcache[fn] = {}
148 rcache[fn] = {}
149 fl = repo.file(fn)
149 fl = repo.file(fn)
150 for i in fl:
150 for i in fl:
151 lr = fl.linkrev(i)
151 lr = fl.linkrev(i)
152 renamed = fl.renamed(fl.node(i))
152 renamed = fl.renamed(fl.node(i))
153 rcache[fn][lr] = renamed
153 rcache[fn][lr] = renamed
154 if lr >= endrev:
154 if lr >= endrev:
155 break
155 break
156 if rev in rcache[fn]:
156 if rev in rcache[fn]:
157 return rcache[fn][rev]
157 return rcache[fn][rev]
158
158
159 # If linkrev != rev (i.e. rev not found in rcache) fallback to
159 # If linkrev != rev (i.e. rev not found in rcache) fallback to
160 # filectx logic.
160 # filectx logic.
161 try:
161 try:
162 return repo[rev][fn].renamed()
162 return repo[rev][fn].renamed()
163 except error.LookupError:
163 except error.LookupError:
164 return None
164 return None
165
165
166 return getrenamed
166 return getrenamed
167
167
168
168
169 def showauthor(repo, ctx, templ, **args):
169 def showauthor(repo, ctx, templ, **args):
170 """:author: String. The unmodified author of the changeset."""
170 """:author: String. The unmodified author of the changeset."""
171 return ctx.user()
171 return ctx.user()
172
172
173 def showbisect(repo, ctx, templ, **args):
173 def showbisect(repo, ctx, templ, **args):
174 """:bisect: String. The changeset bisection status."""
174 """:bisect: String. The changeset bisection status."""
175 return hbisect.label(repo, ctx.node())
175 return hbisect.label(repo, ctx.node())
176
176
177 def showbranch(**args):
177 def showbranch(**args):
178 """:branch: String. The name of the branch on which the changeset was
178 """:branch: String. The name of the branch on which the changeset was
179 committed.
179 committed.
180 """
180 """
181 return args['ctx'].branch()
181 return args['ctx'].branch()
182
182
183 def showbranches(**args):
183 def showbranches(**args):
184 """:branches: List of strings. The name of the branch on which the
184 """:branches: List of strings. The name of the branch on which the
185 changeset was committed. Will be empty if the branch name was
185 changeset was committed. Will be empty if the branch name was
186 default.
186 default.
187 """
187 """
188 branch = args['ctx'].branch()
188 branch = args['ctx'].branch()
189 if branch != 'default':
189 if branch != 'default':
190 return showlist('branch', [branch], plural='branches', **args)
190 return showlist('branch', [branch], plural='branches', **args)
191 return showlist('branch', [], plural='branches', **args)
191 return showlist('branch', [], plural='branches', **args)
192
192
193 def showbookmarks(**args):
193 def showbookmarks(**args):
194 """:bookmarks: List of strings. Any bookmarks associated with the
194 """:bookmarks: List of strings. Any bookmarks associated with the
195 changeset.
195 changeset.
196 """
196 """
197 bookmarks = args['ctx'].bookmarks()
197 bookmarks = args['ctx'].bookmarks()
198 return showlist('bookmark', bookmarks, **args)
198 return showlist('bookmark', bookmarks, **args)
199
199
200 def showchildren(**args):
200 def showchildren(**args):
201 """:children: List of strings. The children of the changeset."""
201 """:children: List of strings. The children of the changeset."""
202 ctx = args['ctx']
202 ctx = args['ctx']
203 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
203 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
204 return showlist('children', childrevs, element='child', **args)
204 return showlist('children', childrevs, element='child', **args)
205
205
206 def showdate(repo, ctx, templ, **args):
206 def showdate(repo, ctx, templ, **args):
207 """:date: Date information. The date when the changeset was committed."""
207 """:date: Date information. The date when the changeset was committed."""
208 return ctx.date()
208 return ctx.date()
209
209
210 def showdescription(repo, ctx, templ, **args):
210 def showdescription(repo, ctx, templ, **args):
211 """:desc: String. The text of the changeset description."""
211 """:desc: String. The text of the changeset description."""
212 return ctx.description().strip()
212 return ctx.description().strip()
213
213
214 def showdiffstat(repo, ctx, templ, **args):
214 def showdiffstat(repo, ctx, templ, **args):
215 """:diffstat: String. Statistics of changes with the following format:
215 """:diffstat: String. Statistics of changes with the following format:
216 "modified files: +added/-removed lines"
216 "modified files: +added/-removed lines"
217 """
217 """
218 stats = patch.diffstatdata(util.iterlines(ctx.diff()))
218 stats = patch.diffstatdata(util.iterlines(ctx.diff()))
219 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
219 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
220 return '%s: +%s/-%s' % (len(stats), adds, removes)
220 return '%s: +%s/-%s' % (len(stats), adds, removes)
221
221
222 def showextras(**args):
222 def showextras(**args):
223 """:extras: List of dicts with key, value entries of the 'extras'
223 """:extras: List of dicts with key, value entries of the 'extras'
224 field of this changeset."""
224 field of this changeset."""
225 yield showlist('extra', sorted(dict(key=a, value=b)
225 extras = args['ctx'].extra()
226 for (a, b) in args['ctx'].extra().items()), **args)
226 c = [{'key': x[0], 'value': x[1]} for x in sorted(extras.items())]
227 f = _showlist('extra', c, plural='extras', **args)
228 return _hybrid(f, c, lambda x: '%s=%s' % (x['key'], x['value']))
227
229
228 def showfileadds(**args):
230 def showfileadds(**args):
229 """:file_adds: List of strings. Files added by this changeset."""
231 """:file_adds: List of strings. Files added by this changeset."""
230 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
232 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
231 return showlist('file_add', getfiles(repo, ctx, revcache)[1],
233 return showlist('file_add', getfiles(repo, ctx, revcache)[1],
232 element='file', **args)
234 element='file', **args)
233
235
234 def showfilecopies(**args):
236 def showfilecopies(**args):
235 """:file_copies: List of strings. Files copied in this changeset with
237 """:file_copies: List of strings. Files copied in this changeset with
236 their sources.
238 their sources.
237 """
239 """
238 cache, ctx = args['cache'], args['ctx']
240 cache, ctx = args['cache'], args['ctx']
239 copies = args['revcache'].get('copies')
241 copies = args['revcache'].get('copies')
240 if copies is None:
242 if copies is None:
241 if 'getrenamed' not in cache:
243 if 'getrenamed' not in cache:
242 cache['getrenamed'] = getrenamedfn(args['repo'])
244 cache['getrenamed'] = getrenamedfn(args['repo'])
243 copies = []
245 copies = []
244 getrenamed = cache['getrenamed']
246 getrenamed = cache['getrenamed']
245 for fn in ctx.files():
247 for fn in ctx.files():
246 rename = getrenamed(fn, ctx.rev())
248 rename = getrenamed(fn, ctx.rev())
247 if rename:
249 if rename:
248 copies.append((fn, rename[0]))
250 copies.append((fn, rename[0]))
249
251
250 c = [{'name': x[0], 'source': x[1]} for x in copies]
252 c = [{'name': x[0], 'source': x[1]} for x in copies]
251 f = _showlist('file_copy', c, plural='file_copies', **args)
253 f = _showlist('file_copy', c, plural='file_copies', **args)
252 return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
254 return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
253
255
254 # showfilecopiesswitch() displays file copies only if copy records are
256 # showfilecopiesswitch() displays file copies only if copy records are
255 # provided before calling the templater, usually with a --copies
257 # provided before calling the templater, usually with a --copies
256 # command line switch.
258 # command line switch.
257 def showfilecopiesswitch(**args):
259 def showfilecopiesswitch(**args):
258 """:file_copies_switch: List of strings. Like "file_copies" but displayed
260 """:file_copies_switch: List of strings. Like "file_copies" but displayed
259 only if the --copied switch is set.
261 only if the --copied switch is set.
260 """
262 """
261 copies = args['revcache'].get('copies') or []
263 copies = args['revcache'].get('copies') or []
262 c = [{'name': x[0], 'source': x[1]} for x in copies]
264 c = [{'name': x[0], 'source': x[1]} for x in copies]
263 f = _showlist('file_copy', c, plural='file_copies', **args)
265 f = _showlist('file_copy', c, plural='file_copies', **args)
264 return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
266 return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
265
267
266 def showfiledels(**args):
268 def showfiledels(**args):
267 """:file_dels: List of strings. Files removed by this changeset."""
269 """:file_dels: List of strings. Files removed by this changeset."""
268 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
270 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
269 return showlist('file_del', getfiles(repo, ctx, revcache)[2],
271 return showlist('file_del', getfiles(repo, ctx, revcache)[2],
270 element='file', **args)
272 element='file', **args)
271
273
272 def showfilemods(**args):
274 def showfilemods(**args):
273 """:file_mods: List of strings. Files modified by this changeset."""
275 """:file_mods: List of strings. Files modified by this changeset."""
274 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
276 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
275 return showlist('file_mod', getfiles(repo, ctx, revcache)[0],
277 return showlist('file_mod', getfiles(repo, ctx, revcache)[0],
276 element='file', **args)
278 element='file', **args)
277
279
278 def showfiles(**args):
280 def showfiles(**args):
279 """:files: List of strings. All files modified, added, or removed by this
281 """:files: List of strings. All files modified, added, or removed by this
280 changeset.
282 changeset.
281 """
283 """
282 return showlist('file', args['ctx'].files(), **args)
284 return showlist('file', args['ctx'].files(), **args)
283
285
284 def showlatesttag(repo, ctx, templ, cache, **args):
286 def showlatesttag(repo, ctx, templ, cache, **args):
285 """:latesttag: String. Most recent global tag in the ancestors of this
287 """:latesttag: String. Most recent global tag in the ancestors of this
286 changeset.
288 changeset.
287 """
289 """
288 return getlatesttags(repo, ctx, cache)[2]
290 return getlatesttags(repo, ctx, cache)[2]
289
291
290 def showlatesttagdistance(repo, ctx, templ, cache, **args):
292 def showlatesttagdistance(repo, ctx, templ, cache, **args):
291 """:latesttagdistance: Integer. Longest path to the latest tag."""
293 """:latesttagdistance: Integer. Longest path to the latest tag."""
292 return getlatesttags(repo, ctx, cache)[1]
294 return getlatesttags(repo, ctx, cache)[1]
293
295
294 def showmanifest(**args):
296 def showmanifest(**args):
295 repo, ctx, templ = args['repo'], args['ctx'], args['templ']
297 repo, ctx, templ = args['repo'], args['ctx'], args['templ']
296 args = args.copy()
298 args = args.copy()
297 args.update(dict(rev=repo.manifest.rev(ctx.changeset()[0]),
299 args.update(dict(rev=repo.manifest.rev(ctx.changeset()[0]),
298 node=hex(ctx.changeset()[0])))
300 node=hex(ctx.changeset()[0])))
299 return templ('manifest', **args)
301 return templ('manifest', **args)
300
302
301 def shownode(repo, ctx, templ, **args):
303 def shownode(repo, ctx, templ, **args):
302 """:node: String. The changeset identification hash, as a 40 hexadecimal
304 """:node: String. The changeset identification hash, as a 40 hexadecimal
303 digit string.
305 digit string.
304 """
306 """
305 return ctx.hex()
307 return ctx.hex()
306
308
307 def showp1rev(repo, ctx, templ, **args):
309 def showp1rev(repo, ctx, templ, **args):
308 """:p1rev: Integer. The repository-local revision number of the changeset's
310 """:p1rev: Integer. The repository-local revision number of the changeset's
309 first parent, or -1 if the changeset has no parents."""
311 first parent, or -1 if the changeset has no parents."""
310 return ctx.p1().rev()
312 return ctx.p1().rev()
311
313
312 def showp2rev(repo, ctx, templ, **args):
314 def showp2rev(repo, ctx, templ, **args):
313 """:p2rev: Integer. The repository-local revision number of the changeset's
315 """:p2rev: Integer. The repository-local revision number of the changeset's
314 second parent, or -1 if the changeset has no second parent."""
316 second parent, or -1 if the changeset has no second parent."""
315 return ctx.p2().rev()
317 return ctx.p2().rev()
316
318
317 def showp1node(repo, ctx, templ, **args):
319 def showp1node(repo, ctx, templ, **args):
318 """:p1node: String. The identification hash of the changeset's first parent,
320 """:p1node: String. The identification hash of the changeset's first parent,
319 as a 40 digit hexadecimal string. If the changeset has no parents, all
321 as a 40 digit hexadecimal string. If the changeset has no parents, all
320 digits are 0."""
322 digits are 0."""
321 return ctx.p1().hex()
323 return ctx.p1().hex()
322
324
323 def showp2node(repo, ctx, templ, **args):
325 def showp2node(repo, ctx, templ, **args):
324 """:p2node: String. The identification hash of the changeset's second
326 """:p2node: String. The identification hash of the changeset's second
325 parent, as a 40 digit hexadecimal string. If the changeset has no second
327 parent, as a 40 digit hexadecimal string. If the changeset has no second
326 parent, all digits are 0."""
328 parent, all digits are 0."""
327 return ctx.p2().hex()
329 return ctx.p2().hex()
328
330
329 def showphase(repo, ctx, templ, **args):
331 def showphase(repo, ctx, templ, **args):
330 """:phase: String. The changeset phase name."""
332 """:phase: String. The changeset phase name."""
331 return ctx.phasestr()
333 return ctx.phasestr()
332
334
333 def showphaseidx(repo, ctx, templ, **args):
335 def showphaseidx(repo, ctx, templ, **args):
334 """:phaseidx: Integer. The changeset phase index."""
336 """:phaseidx: Integer. The changeset phase index."""
335 return ctx.phase()
337 return ctx.phase()
336
338
337 def showrev(repo, ctx, templ, **args):
339 def showrev(repo, ctx, templ, **args):
338 """:rev: Integer. The repository-local changeset revision number."""
340 """:rev: Integer. The repository-local changeset revision number."""
339 return ctx.rev()
341 return ctx.rev()
340
342
341 def showtags(**args):
343 def showtags(**args):
342 """:tags: List of strings. Any tags associated with the changeset."""
344 """:tags: List of strings. Any tags associated with the changeset."""
343 return showlist('tag', args['ctx'].tags(), **args)
345 return showlist('tag', args['ctx'].tags(), **args)
344
346
345 # keywords are callables like:
347 # keywords are callables like:
346 # fn(repo, ctx, templ, cache, revcache, **args)
348 # fn(repo, ctx, templ, cache, revcache, **args)
347 # with:
349 # with:
348 # repo - current repository instance
350 # repo - current repository instance
349 # ctx - the changectx being displayed
351 # ctx - the changectx being displayed
350 # templ - the templater instance
352 # templ - the templater instance
351 # cache - a cache dictionary for the whole templater run
353 # cache - a cache dictionary for the whole templater run
352 # revcache - a cache dictionary for the current revision
354 # revcache - a cache dictionary for the current revision
353 keywords = {
355 keywords = {
354 'author': showauthor,
356 'author': showauthor,
355 'bisect': showbisect,
357 'bisect': showbisect,
356 'branch': showbranch,
358 'branch': showbranch,
357 'branches': showbranches,
359 'branches': showbranches,
358 'bookmarks': showbookmarks,
360 'bookmarks': showbookmarks,
359 'children': showchildren,
361 'children': showchildren,
360 'date': showdate,
362 'date': showdate,
361 'desc': showdescription,
363 'desc': showdescription,
362 'diffstat': showdiffstat,
364 'diffstat': showdiffstat,
363 'extras': showextras,
365 'extras': showextras,
364 'file_adds': showfileadds,
366 'file_adds': showfileadds,
365 'file_copies': showfilecopies,
367 'file_copies': showfilecopies,
366 'file_copies_switch': showfilecopiesswitch,
368 'file_copies_switch': showfilecopiesswitch,
367 'file_dels': showfiledels,
369 'file_dels': showfiledels,
368 'file_mods': showfilemods,
370 'file_mods': showfilemods,
369 'files': showfiles,
371 'files': showfiles,
370 'latesttag': showlatesttag,
372 'latesttag': showlatesttag,
371 'latesttagdistance': showlatesttagdistance,
373 'latesttagdistance': showlatesttagdistance,
372 'manifest': showmanifest,
374 'manifest': showmanifest,
373 'node': shownode,
375 'node': shownode,
374 'p1rev': showp1rev,
376 'p1rev': showp1rev,
375 'p1node': showp1node,
377 'p1node': showp1node,
376 'p2rev': showp2rev,
378 'p2rev': showp2rev,
377 'p2node': showp2node,
379 'p2node': showp2node,
378 'phase': showphase,
380 'phase': showphase,
379 'phaseidx': showphaseidx,
381 'phaseidx': showphaseidx,
380 'rev': showrev,
382 'rev': showrev,
381 'tags': showtags,
383 'tags': showtags,
382 }
384 }
383
385
384 def _showparents(**args):
386 def _showparents(**args):
385 """:parents: List of strings. The parents of the changeset in "rev:node"
387 """:parents: List of strings. The parents of the changeset in "rev:node"
386 format. If the changeset has only one "natural" parent (the predecessor
388 format. If the changeset has only one "natural" parent (the predecessor
387 revision) nothing is shown."""
389 revision) nothing is shown."""
388 pass
390 pass
389
391
390 dockeywords = {
392 dockeywords = {
391 'parents': _showparents,
393 'parents': _showparents,
392 }
394 }
393 dockeywords.update(keywords)
395 dockeywords.update(keywords)
394 del dockeywords['branches']
396 del dockeywords['branches']
395
397
396 # tell hggettext to extract docstrings from these functions:
398 # tell hggettext to extract docstrings from these functions:
397 i18nfunctions = dockeywords.values()
399 i18nfunctions = dockeywords.values()
General Comments 0
You need to be logged in to leave comments. Login now