Show More
@@ -81,10 +81,10 b' def unwraphybrid(thing):' | |||||
81 | def showlist(name, values, plural=None, element=None, separator=' ', **mapping): |
|
81 | def showlist(name, values, plural=None, element=None, separator=' ', **mapping): | |
82 | if not element: |
|
82 | if not element: | |
83 | element = name |
|
83 | element = name | |
84 |
f = _showlist(name, values, plural, separator |
|
84 | f = _showlist(name, values, mapping, plural, separator) | |
85 | return hybridlist(values, name=element, gen=f) |
|
85 | return hybridlist(values, name=element, gen=f) | |
86 |
|
86 | |||
87 |
def _showlist(name, values, plural=None, separator=' ' |
|
87 | def _showlist(name, values, mapping, plural=None, separator=' '): | |
88 | '''expand set of values. |
|
88 | '''expand set of values. | |
89 | name is name of key in template map. |
|
89 | name is name of key in template map. | |
90 | values is list of strings or dicts. |
|
90 | values is list of strings or dicts. | |
@@ -295,7 +295,7 b' def showbookmarks(**args):' | |||||
295 | bookmarks = args['ctx'].bookmarks() |
|
295 | bookmarks = args['ctx'].bookmarks() | |
296 | active = repo._activebookmark |
|
296 | active = repo._activebookmark | |
297 | makemap = lambda v: {'bookmark': v, 'active': active, 'current': active} |
|
297 | makemap = lambda v: {'bookmark': v, 'active': active, 'current': active} | |
298 |
f = _showlist('bookmark', bookmarks, |
|
298 | f = _showlist('bookmark', bookmarks, args) | |
299 | return _hybrid(f, bookmarks, makemap, lambda x: x['bookmark']) |
|
299 | return _hybrid(f, bookmarks, makemap, lambda x: x['bookmark']) | |
300 |
|
300 | |||
301 | @templatekeyword('children') |
|
301 | @templatekeyword('children') | |
@@ -353,7 +353,7 b' def showenvvars(repo, **args):' | |||||
353 | env = util.sortdict((k, env[k]) for k in sorted(env)) |
|
353 | env = util.sortdict((k, env[k]) for k in sorted(env)) | |
354 | makemap = lambda k: {'key': k, 'value': env[k]} |
|
354 | makemap = lambda k: {'key': k, 'value': env[k]} | |
355 | c = [makemap(k) for k in env] |
|
355 | c = [makemap(k) for k in env] | |
356 |
f = _showlist('envvar', c, plural='envvars' |
|
356 | f = _showlist('envvar', c, args, plural='envvars') | |
357 | return _hybrid(f, env, makemap, |
|
357 | return _hybrid(f, env, makemap, | |
358 | lambda x: '%s=%s' % (x['key'], x['value'])) |
|
358 | lambda x: '%s=%s' % (x['key'], x['value'])) | |
359 |
|
359 | |||
@@ -365,7 +365,7 b' def showextras(**args):' | |||||
365 | extras = util.sortdict((k, extras[k]) for k in sorted(extras)) |
|
365 | extras = util.sortdict((k, extras[k]) for k in sorted(extras)) | |
366 | makemap = lambda k: {'key': k, 'value': extras[k]} |
|
366 | makemap = lambda k: {'key': k, 'value': extras[k]} | |
367 | c = [makemap(k) for k in extras] |
|
367 | c = [makemap(k) for k in extras] | |
368 |
f = _showlist('extra', c, plural='extras' |
|
368 | f = _showlist('extra', c, args, plural='extras') | |
369 | return _hybrid(f, extras, makemap, |
|
369 | return _hybrid(f, extras, makemap, | |
370 | lambda x: '%s=%s' % (x['key'], util.escapestr(x['value']))) |
|
370 | lambda x: '%s=%s' % (x['key'], util.escapestr(x['value']))) | |
371 |
|
371 | |||
@@ -396,7 +396,7 b' def showfilecopies(**args):' | |||||
396 | copies = util.sortdict(copies) |
|
396 | copies = util.sortdict(copies) | |
397 | makemap = lambda k: {'name': k, 'source': copies[k]} |
|
397 | makemap = lambda k: {'name': k, 'source': copies[k]} | |
398 | c = [makemap(k) for k in copies] |
|
398 | c = [makemap(k) for k in copies] | |
399 |
f = _showlist('file_copy', c, plural='file_copies' |
|
399 | f = _showlist('file_copy', c, args, plural='file_copies') | |
400 | return _hybrid(f, copies, makemap, |
|
400 | return _hybrid(f, copies, makemap, | |
401 | lambda x: '%s (%s)' % (x['name'], x['source'])) |
|
401 | lambda x: '%s (%s)' % (x['name'], x['source'])) | |
402 |
|
402 | |||
@@ -412,7 +412,7 b' def showfilecopiesswitch(**args):' | |||||
412 | copies = util.sortdict(copies) |
|
412 | copies = util.sortdict(copies) | |
413 | makemap = lambda k: {'name': k, 'source': copies[k]} |
|
413 | makemap = lambda k: {'name': k, 'source': copies[k]} | |
414 | c = [makemap(k) for k in copies] |
|
414 | c = [makemap(k) for k in copies] | |
415 |
f = _showlist('file_copy', c, plural='file_copies' |
|
415 | f = _showlist('file_copy', c, args, plural='file_copies') | |
416 | return _hybrid(f, copies, makemap, |
|
416 | return _hybrid(f, copies, makemap, | |
417 | lambda x: '%s (%s)' % (x['name'], x['source'])) |
|
417 | lambda x: '%s (%s)' % (x['name'], x['source'])) | |
418 |
|
418 | |||
@@ -484,7 +484,7 b' def showlatesttags(pattern, **args):' | |||||
484 | } |
|
484 | } | |
485 |
|
485 | |||
486 | tags = latesttags[2] |
|
486 | tags = latesttags[2] | |
487 |
f = _showlist('latesttag', tags, separator=':' |
|
487 | f = _showlist('latesttag', tags, args, separator=':') | |
488 | return _hybrid(f, tags, makemap, lambda x: x['latesttag']) |
|
488 | return _hybrid(f, tags, makemap, lambda x: x['latesttag']) | |
489 |
|
489 | |||
490 | @templatekeyword('latesttagdistance') |
|
490 | @templatekeyword('latesttagdistance') | |
@@ -540,7 +540,7 b' def shownamespaces(**args):' | |||||
540 | namespaces = util.sortdict((k, showlist('name', ns.names(repo, ctx.node()), |
|
540 | namespaces = util.sortdict((k, showlist('name', ns.names(repo, ctx.node()), | |
541 | **args)) |
|
541 | **args)) | |
542 | for k, ns in repo.names.iteritems()) |
|
542 | for k, ns in repo.names.iteritems()) | |
543 |
f = _showlist('namespace', list(namespaces), |
|
543 | f = _showlist('namespace', list(namespaces), args) | |
544 | return _hybrid(f, namespaces, |
|
544 | return _hybrid(f, namespaces, | |
545 | lambda k: {'namespace': k, 'names': namespaces[k]}, |
|
545 | lambda k: {'namespace': k, 'names': namespaces[k]}, | |
546 | lambda x: x['namespace']) |
|
546 | lambda x: x['namespace']) | |
@@ -599,7 +599,7 b' def showparents(**args):' | |||||
599 | ('node', p.hex()), |
|
599 | ('node', p.hex()), | |
600 | ('phase', p.phasestr())] |
|
600 | ('phase', p.phasestr())] | |
601 | for p in pctxs] |
|
601 | for p in pctxs] | |
602 |
f = _showlist('parent', parents, |
|
602 | f = _showlist('parent', parents, args) | |
603 | return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}}, |
|
603 | return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}}, | |
604 | lambda d: _formatrevnode(d['ctx'])) |
|
604 | lambda d: _formatrevnode(d['ctx'])) | |
605 |
|
605 | |||
@@ -623,7 +623,7 b' def showrevslist(name, revs, **args):' | |||||
623 | be evaluated""" |
|
623 | be evaluated""" | |
624 | repo = args['ctx'].repo() |
|
624 | repo = args['ctx'].repo() | |
625 | revs = [str(r) for r in revs] # ifcontains() needs a list of str |
|
625 | revs = [str(r) for r in revs] # ifcontains() needs a list of str | |
626 |
f = _showlist(name, revs, |
|
626 | f = _showlist(name, revs, args) | |
627 | return _hybrid(f, revs, |
|
627 | return _hybrid(f, revs, | |
628 | lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}}, |
|
628 | lambda x: {name: x, 'ctx': repo[int(x)], 'revcache': {}}, | |
629 | lambda d: d[name]) |
|
629 | lambda d: d[name]) |
General Comments 0
You need to be logged in to leave comments.
Login now