##// END OF EJS Templates
template: change extras to use showlist rather than manual templ call....
Matthew Turk -
r20017:519120a9 default
parent child Browse files
Show More
@@ -1,398 +1,395
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
191
192 def showbookmarks(**args):
192 def showbookmarks(**args):
193 """:bookmarks: List of strings. Any bookmarks associated with the
193 """:bookmarks: List of strings. Any bookmarks associated with the
194 changeset.
194 changeset.
195 """
195 """
196 bookmarks = args['ctx'].bookmarks()
196 bookmarks = args['ctx'].bookmarks()
197 return showlist('bookmark', bookmarks, **args)
197 return showlist('bookmark', bookmarks, **args)
198
198
199 def showchildren(**args):
199 def showchildren(**args):
200 """:children: List of strings. The children of the changeset."""
200 """:children: List of strings. The children of the changeset."""
201 ctx = args['ctx']
201 ctx = args['ctx']
202 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
202 childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
203 return showlist('children', childrevs, element='child', **args)
203 return showlist('children', childrevs, element='child', **args)
204
204
205 def showdate(repo, ctx, templ, **args):
205 def showdate(repo, ctx, templ, **args):
206 """:date: Date information. The date when the changeset was committed."""
206 """:date: Date information. The date when the changeset was committed."""
207 return ctx.date()
207 return ctx.date()
208
208
209 def showdescription(repo, ctx, templ, **args):
209 def showdescription(repo, ctx, templ, **args):
210 """:desc: String. The text of the changeset description."""
210 """:desc: String. The text of the changeset description."""
211 return ctx.description().strip()
211 return ctx.description().strip()
212
212
213 def showdiffstat(repo, ctx, templ, **args):
213 def showdiffstat(repo, ctx, templ, **args):
214 """:diffstat: String. Statistics of changes with the following format:
214 """:diffstat: String. Statistics of changes with the following format:
215 "modified files: +added/-removed lines"
215 "modified files: +added/-removed lines"
216 """
216 """
217 stats = patch.diffstatdata(util.iterlines(ctx.diff()))
217 stats = patch.diffstatdata(util.iterlines(ctx.diff()))
218 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
218 maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
219 return '%s: +%s/-%s' % (len(stats), adds, removes)
219 return '%s: +%s/-%s' % (len(stats), adds, removes)
220
220
221 def showextras(**args):
221 def showextras(**args):
222 """:extras: List of dicts with key, value entries of the 'extras'
222 """:extras: List of dicts with key, value entries of the 'extras'
223 field of this changeset."""
223 field of this changeset."""
224 templ = args['templ']
224 yield showlist('extra', sorted(dict(key=a, value=b)
225 for key, value in sorted(args['ctx'].extra().items()):
225 for (a, b) in args['ctx'].extra().items()), **args)
226 args = args.copy()
227 args.update(dict(key=key, value=value))
228 yield templ('extra', **args)
229
226
230 def showfileadds(**args):
227 def showfileadds(**args):
231 """:file_adds: List of strings. Files added by this changeset."""
228 """:file_adds: List of strings. Files added by this changeset."""
232 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
229 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
233 return showlist('file_add', getfiles(repo, ctx, revcache)[1],
230 return showlist('file_add', getfiles(repo, ctx, revcache)[1],
234 element='file', **args)
231 element='file', **args)
235
232
236 def showfilecopies(**args):
233 def showfilecopies(**args):
237 """:file_copies: List of strings. Files copied in this changeset with
234 """:file_copies: List of strings. Files copied in this changeset with
238 their sources.
235 their sources.
239 """
236 """
240 cache, ctx = args['cache'], args['ctx']
237 cache, ctx = args['cache'], args['ctx']
241 copies = args['revcache'].get('copies')
238 copies = args['revcache'].get('copies')
242 if copies is None:
239 if copies is None:
243 if 'getrenamed' not in cache:
240 if 'getrenamed' not in cache:
244 cache['getrenamed'] = getrenamedfn(args['repo'])
241 cache['getrenamed'] = getrenamedfn(args['repo'])
245 copies = []
242 copies = []
246 getrenamed = cache['getrenamed']
243 getrenamed = cache['getrenamed']
247 for fn in ctx.files():
244 for fn in ctx.files():
248 rename = getrenamed(fn, ctx.rev())
245 rename = getrenamed(fn, ctx.rev())
249 if rename:
246 if rename:
250 copies.append((fn, rename[0]))
247 copies.append((fn, rename[0]))
251
248
252 c = [{'name': x[0], 'source': x[1]} for x in copies]
249 c = [{'name': x[0], 'source': x[1]} for x in copies]
253 f = _showlist('file_copy', c, plural='file_copies', **args)
250 f = _showlist('file_copy', c, plural='file_copies', **args)
254 return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
251 return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
255
252
256 # showfilecopiesswitch() displays file copies only if copy records are
253 # showfilecopiesswitch() displays file copies only if copy records are
257 # provided before calling the templater, usually with a --copies
254 # provided before calling the templater, usually with a --copies
258 # command line switch.
255 # command line switch.
259 def showfilecopiesswitch(**args):
256 def showfilecopiesswitch(**args):
260 """:file_copies_switch: List of strings. Like "file_copies" but displayed
257 """:file_copies_switch: List of strings. Like "file_copies" but displayed
261 only if the --copied switch is set.
258 only if the --copied switch is set.
262 """
259 """
263 copies = args['revcache'].get('copies') or []
260 copies = args['revcache'].get('copies') or []
264 c = [{'name': x[0], 'source': x[1]} for x in copies]
261 c = [{'name': x[0], 'source': x[1]} for x in copies]
265 f = _showlist('file_copy', c, plural='file_copies', **args)
262 f = _showlist('file_copy', c, plural='file_copies', **args)
266 return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
263 return _hybrid(f, c, lambda x: '%s (%s)' % (x['name'], x['source']))
267
264
268 def showfiledels(**args):
265 def showfiledels(**args):
269 """:file_dels: List of strings. Files removed by this changeset."""
266 """:file_dels: List of strings. Files removed by this changeset."""
270 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
267 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
271 return showlist('file_del', getfiles(repo, ctx, revcache)[2],
268 return showlist('file_del', getfiles(repo, ctx, revcache)[2],
272 element='file', **args)
269 element='file', **args)
273
270
274 def showfilemods(**args):
271 def showfilemods(**args):
275 """:file_mods: List of strings. Files modified by this changeset."""
272 """:file_mods: List of strings. Files modified by this changeset."""
276 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
273 repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
277 return showlist('file_mod', getfiles(repo, ctx, revcache)[0],
274 return showlist('file_mod', getfiles(repo, ctx, revcache)[0],
278 element='file', **args)
275 element='file', **args)
279
276
280 def showfiles(**args):
277 def showfiles(**args):
281 """:files: List of strings. All files modified, added, or removed by this
278 """:files: List of strings. All files modified, added, or removed by this
282 changeset.
279 changeset.
283 """
280 """
284 return showlist('file', args['ctx'].files(), **args)
281 return showlist('file', args['ctx'].files(), **args)
285
282
286 def showlatesttag(repo, ctx, templ, cache, **args):
283 def showlatesttag(repo, ctx, templ, cache, **args):
287 """:latesttag: String. Most recent global tag in the ancestors of this
284 """:latesttag: String. Most recent global tag in the ancestors of this
288 changeset.
285 changeset.
289 """
286 """
290 return getlatesttags(repo, ctx, cache)[2]
287 return getlatesttags(repo, ctx, cache)[2]
291
288
292 def showlatesttagdistance(repo, ctx, templ, cache, **args):
289 def showlatesttagdistance(repo, ctx, templ, cache, **args):
293 """:latesttagdistance: Integer. Longest path to the latest tag."""
290 """:latesttagdistance: Integer. Longest path to the latest tag."""
294 return getlatesttags(repo, ctx, cache)[1]
291 return getlatesttags(repo, ctx, cache)[1]
295
292
296 def showmanifest(**args):
293 def showmanifest(**args):
297 repo, ctx, templ = args['repo'], args['ctx'], args['templ']
294 repo, ctx, templ = args['repo'], args['ctx'], args['templ']
298 args = args.copy()
295 args = args.copy()
299 args.update(dict(rev=repo.manifest.rev(ctx.changeset()[0]),
296 args.update(dict(rev=repo.manifest.rev(ctx.changeset()[0]),
300 node=hex(ctx.changeset()[0])))
297 node=hex(ctx.changeset()[0])))
301 return templ('manifest', **args)
298 return templ('manifest', **args)
302
299
303 def shownode(repo, ctx, templ, **args):
300 def shownode(repo, ctx, templ, **args):
304 """:node: String. The changeset identification hash, as a 40 hexadecimal
301 """:node: String. The changeset identification hash, as a 40 hexadecimal
305 digit string.
302 digit string.
306 """
303 """
307 return ctx.hex()
304 return ctx.hex()
308
305
309 def showp1rev(repo, ctx, templ, **args):
306 def showp1rev(repo, ctx, templ, **args):
310 """:p1rev: Integer. The repository-local revision number of the changeset's
307 """:p1rev: Integer. The repository-local revision number of the changeset's
311 first parent, or -1 if the changeset has no parents."""
308 first parent, or -1 if the changeset has no parents."""
312 return ctx.p1().rev()
309 return ctx.p1().rev()
313
310
314 def showp2rev(repo, ctx, templ, **args):
311 def showp2rev(repo, ctx, templ, **args):
315 """:p2rev: Integer. The repository-local revision number of the changeset's
312 """:p2rev: Integer. The repository-local revision number of the changeset's
316 second parent, or -1 if the changeset has no second parent."""
313 second parent, or -1 if the changeset has no second parent."""
317 return ctx.p2().rev()
314 return ctx.p2().rev()
318
315
319 def showp1node(repo, ctx, templ, **args):
316 def showp1node(repo, ctx, templ, **args):
320 """:p1node: String. The identification hash of the changeset's first parent,
317 """:p1node: String. The identification hash of the changeset's first parent,
321 as a 40 digit hexadecimal string. If the changeset has no parents, all
318 as a 40 digit hexadecimal string. If the changeset has no parents, all
322 digits are 0."""
319 digits are 0."""
323 return ctx.p1().hex()
320 return ctx.p1().hex()
324
321
325 def showp2node(repo, ctx, templ, **args):
322 def showp2node(repo, ctx, templ, **args):
326 """:p2node: String. The identification hash of the changeset's second
323 """:p2node: String. The identification hash of the changeset's second
327 parent, as a 40 digit hexadecimal string. If the changeset has no second
324 parent, as a 40 digit hexadecimal string. If the changeset has no second
328 parent, all digits are 0."""
325 parent, all digits are 0."""
329 return ctx.p2().hex()
326 return ctx.p2().hex()
330
327
331 def showphase(repo, ctx, templ, **args):
328 def showphase(repo, ctx, templ, **args):
332 """:phase: String. The changeset phase name."""
329 """:phase: String. The changeset phase name."""
333 return ctx.phasestr()
330 return ctx.phasestr()
334
331
335 def showphaseidx(repo, ctx, templ, **args):
332 def showphaseidx(repo, ctx, templ, **args):
336 """:phaseidx: Integer. The changeset phase index."""
333 """:phaseidx: Integer. The changeset phase index."""
337 return ctx.phase()
334 return ctx.phase()
338
335
339 def showrev(repo, ctx, templ, **args):
336 def showrev(repo, ctx, templ, **args):
340 """:rev: Integer. The repository-local changeset revision number."""
337 """:rev: Integer. The repository-local changeset revision number."""
341 return ctx.rev()
338 return ctx.rev()
342
339
343 def showtags(**args):
340 def showtags(**args):
344 """:tags: List of strings. Any tags associated with the changeset."""
341 """:tags: List of strings. Any tags associated with the changeset."""
345 return showlist('tag', args['ctx'].tags(), **args)
342 return showlist('tag', args['ctx'].tags(), **args)
346
343
347 # keywords are callables like:
344 # keywords are callables like:
348 # fn(repo, ctx, templ, cache, revcache, **args)
345 # fn(repo, ctx, templ, cache, revcache, **args)
349 # with:
346 # with:
350 # repo - current repository instance
347 # repo - current repository instance
351 # ctx - the changectx being displayed
348 # ctx - the changectx being displayed
352 # templ - the templater instance
349 # templ - the templater instance
353 # cache - a cache dictionary for the whole templater run
350 # cache - a cache dictionary for the whole templater run
354 # revcache - a cache dictionary for the current revision
351 # revcache - a cache dictionary for the current revision
355 keywords = {
352 keywords = {
356 'author': showauthor,
353 'author': showauthor,
357 'bisect': showbisect,
354 'bisect': showbisect,
358 'branch': showbranch,
355 'branch': showbranch,
359 'branches': showbranches,
356 'branches': showbranches,
360 'bookmarks': showbookmarks,
357 'bookmarks': showbookmarks,
361 'children': showchildren,
358 'children': showchildren,
362 'date': showdate,
359 'date': showdate,
363 'desc': showdescription,
360 'desc': showdescription,
364 'diffstat': showdiffstat,
361 'diffstat': showdiffstat,
365 'extras': showextras,
362 'extras': showextras,
366 'file_adds': showfileadds,
363 'file_adds': showfileadds,
367 'file_copies': showfilecopies,
364 'file_copies': showfilecopies,
368 'file_copies_switch': showfilecopiesswitch,
365 'file_copies_switch': showfilecopiesswitch,
369 'file_dels': showfiledels,
366 'file_dels': showfiledels,
370 'file_mods': showfilemods,
367 'file_mods': showfilemods,
371 'files': showfiles,
368 'files': showfiles,
372 'latesttag': showlatesttag,
369 'latesttag': showlatesttag,
373 'latesttagdistance': showlatesttagdistance,
370 'latesttagdistance': showlatesttagdistance,
374 'manifest': showmanifest,
371 'manifest': showmanifest,
375 'node': shownode,
372 'node': shownode,
376 'p1rev': showp1rev,
373 'p1rev': showp1rev,
377 'p1node': showp1node,
374 'p1node': showp1node,
378 'p2rev': showp2rev,
375 'p2rev': showp2rev,
379 'p2node': showp2node,
376 'p2node': showp2node,
380 'phase': showphase,
377 'phase': showphase,
381 'phaseidx': showphaseidx,
378 'phaseidx': showphaseidx,
382 'rev': showrev,
379 'rev': showrev,
383 'tags': showtags,
380 'tags': showtags,
384 }
381 }
385
382
386 def _showparents(**args):
383 def _showparents(**args):
387 """:parents: List of strings. The parents of the changeset in "rev:node"
384 """:parents: List of strings. The parents of the changeset in "rev:node"
388 format. If the changeset has only one "natural" parent (the predecessor
385 format. If the changeset has only one "natural" parent (the predecessor
389 revision) nothing is shown."""
386 revision) nothing is shown."""
390 pass
387 pass
391
388
392 dockeywords = {
389 dockeywords = {
393 'parents': _showparents,
390 'parents': _showparents,
394 }
391 }
395 dockeywords.update(keywords)
392 dockeywords.update(keywords)
396
393
397 # tell hggettext to extract docstrings from these functions:
394 # tell hggettext to extract docstrings from these functions:
398 i18nfunctions = dockeywords.values()
395 i18nfunctions = dockeywords.values()
General Comments 0
You need to be logged in to leave comments. Login now