Show More
@@ -339,7 +339,7 b' def shortdate(text):' | |||
|
339 | 339 | @templatefilter('splitlines') |
|
340 | 340 | def splitlines(text): |
|
341 | 341 | """Any text. Split text into a list of lines.""" |
|
342 | return templatekw.showlist('line', text.splitlines(), 'lines') | |
|
342 | return templatekw.showlist('line', text.splitlines(), {}, plural='lines') | |
|
343 | 343 | |
|
344 | 344 | @templatefilter('stringescape') |
|
345 | 345 | def stringescape(text): |
@@ -78,7 +78,7 b' def unwraphybrid(thing):' | |||
|
78 | 78 | return thing |
|
79 | 79 | return thing.gen |
|
80 | 80 | |
|
81 |
def showlist(name, values, plural=None, element=None, separator=' ' |
|
|
81 | def showlist(name, values, mapping, plural=None, element=None, separator=' '): | |
|
82 | 82 | if not element: |
|
83 | 83 | element = name |
|
84 | 84 | f = _showlist(name, values, mapping, plural, separator) |
@@ -283,8 +283,8 b' def showbranches(**args):' | |||
|
283 | 283 | """ |
|
284 | 284 | branch = args['ctx'].branch() |
|
285 | 285 | if branch != 'default': |
|
286 |
return showlist('branch', [branch], plural='branches' |
|
|
287 |
return showlist('branch', [], plural='branches' |
|
|
286 | return showlist('branch', [branch], args, plural='branches') | |
|
287 | return showlist('branch', [], args, plural='branches') | |
|
288 | 288 | |
|
289 | 289 | @templatekeyword('bookmarks') |
|
290 | 290 | def showbookmarks(**args): |
@@ -303,7 +303,7 b' def showchildren(**args):' | |||
|
303 | 303 | """List of strings. The children of the changeset.""" |
|
304 | 304 | ctx = args['ctx'] |
|
305 | 305 | childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()] |
|
306 |
return showlist('children', childrevs, element='child' |
|
|
306 | return showlist('children', childrevs, args, element='child') | |
|
307 | 307 | |
|
308 | 308 | # Deprecated, but kept alive for help generation a purpose. |
|
309 | 309 | @templatekeyword('currentbookmark') |
@@ -373,8 +373,8 b' def showextras(**args):' | |||
|
373 | 373 | def showfileadds(**args): |
|
374 | 374 | """List of strings. Files added by this changeset.""" |
|
375 | 375 | repo, ctx, revcache = args['repo'], args['ctx'], args['revcache'] |
|
376 | return showlist('file_add', getfiles(repo, ctx, revcache)[1], | |
|
377 |
element='file' |
|
|
376 | return showlist('file_add', getfiles(repo, ctx, revcache)[1], args, | |
|
377 | element='file') | |
|
378 | 378 | |
|
379 | 379 | @templatekeyword('file_copies') |
|
380 | 380 | def showfilecopies(**args): |
@@ -420,22 +420,22 b' def showfilecopiesswitch(**args):' | |||
|
420 | 420 | def showfiledels(**args): |
|
421 | 421 | """List of strings. Files removed by this changeset.""" |
|
422 | 422 | repo, ctx, revcache = args['repo'], args['ctx'], args['revcache'] |
|
423 | return showlist('file_del', getfiles(repo, ctx, revcache)[2], | |
|
424 |
element='file' |
|
|
423 | return showlist('file_del', getfiles(repo, ctx, revcache)[2], args, | |
|
424 | element='file') | |
|
425 | 425 | |
|
426 | 426 | @templatekeyword('file_mods') |
|
427 | 427 | def showfilemods(**args): |
|
428 | 428 | """List of strings. Files modified by this changeset.""" |
|
429 | 429 | repo, ctx, revcache = args['repo'], args['ctx'], args['revcache'] |
|
430 | return showlist('file_mod', getfiles(repo, ctx, revcache)[0], | |
|
431 |
element='file' |
|
|
430 | return showlist('file_mod', getfiles(repo, ctx, revcache)[0], args, | |
|
431 | element='file') | |
|
432 | 432 | |
|
433 | 433 | @templatekeyword('files') |
|
434 | 434 | def showfiles(**args): |
|
435 | 435 | """List of strings. All files modified, added, or removed by this |
|
436 | 436 | changeset. |
|
437 | 437 | """ |
|
438 |
return showlist('file', args['ctx'].files(), |
|
|
438 | return showlist('file', args['ctx'].files(), args) | |
|
439 | 439 | |
|
440 | 440 | @templatekeyword('graphnode') |
|
441 | 441 | def showgraphnode(repo, ctx, **args): |
@@ -529,7 +529,7 b' def shownames(namespace, **args):' | |||
|
529 | 529 | repo = ctx.repo() |
|
530 | 530 | ns = repo.names[namespace] |
|
531 | 531 | names = ns.names(repo, ctx.node()) |
|
532 |
return showlist(ns.templatename, names, plural=namespace |
|
|
532 | return showlist(ns.templatename, names, args, plural=namespace) | |
|
533 | 533 | |
|
534 | 534 | @templatekeyword('namespaces') |
|
535 | 535 | def shownamespaces(**args): |
@@ -538,7 +538,7 b' def shownamespaces(**args):' | |||
|
538 | 538 | ctx = args['ctx'] |
|
539 | 539 | repo = ctx.repo() |
|
540 | 540 | namespaces = util.sortdict((k, showlist('name', ns.names(repo, ctx.node()), |
|
541 |
|
|
|
541 | args)) | |
|
542 | 542 | for k, ns in repo.names.iteritems()) |
|
543 | 543 | f = _showlist('namespace', list(namespaces), args) |
|
544 | 544 | return _hybrid(f, namespaces, |
@@ -634,7 +634,7 b' def showsubrepos(**args):' | |||
|
634 | 634 | ctx = args['ctx'] |
|
635 | 635 | substate = ctx.substate |
|
636 | 636 | if not substate: |
|
637 |
return showlist('subrepo', [], |
|
|
637 | return showlist('subrepo', [], args) | |
|
638 | 638 | psubstate = ctx.parents()[0].substate or {} |
|
639 | 639 | subrepos = [] |
|
640 | 640 | for sub in substate: |
@@ -643,7 +643,7 b' def showsubrepos(**args):' | |||
|
643 | 643 | for sub in psubstate: |
|
644 | 644 | if sub not in substate: |
|
645 | 645 | subrepos.append(sub) # removed in ctx |
|
646 |
return showlist('subrepo', sorted(subrepos), |
|
|
646 | return showlist('subrepo', sorted(subrepos), args) | |
|
647 | 647 | |
|
648 | 648 | # don't remove "showtags" definition, even though namespaces will put |
|
649 | 649 | # a helper function for "tags" keyword into "keywords" map automatically, |
@@ -670,7 +670,7 b' def showtroubles(**args):' | |||
|
670 | 670 | |
|
671 | 671 | (EXPERIMENTAL) |
|
672 | 672 | """ |
|
673 |
return showlist('trouble', args['ctx'].troubles(), |
|
|
673 | return showlist('trouble', args['ctx'].troubles(), args) | |
|
674 | 674 | |
|
675 | 675 | # tell hggettext to extract docstrings from these functions: |
|
676 | 676 | i18nfunctions = keywords.values() |
@@ -595,7 +595,7 b' def files(context, mapping, args):' | |||
|
595 | 595 | ctx = mapping['ctx'] |
|
596 | 596 | m = ctx.match([raw]) |
|
597 | 597 | files = list(ctx.matches(m)) |
|
598 |
return templatekw.showlist("file", files, |
|
|
598 | return templatekw.showlist("file", files, mapping) | |
|
599 | 599 | |
|
600 | 600 | @templatefunc('fill(text[, width[, initialident[, hangindent]]])') |
|
601 | 601 | def fill(context, mapping, args): |
General Comments 0
You need to be logged in to leave comments.
Login now