Show More
@@ -378,7 +378,7 b' def lfsfiles(repo, ctx, **args):' | |||||
378 | } |
|
378 | } | |
379 |
|
379 | |||
380 | # TODO: make the separator ', '? |
|
380 | # TODO: make the separator ', '? | |
381 | f = templatekw._showlist('lfs_file', files, args) |
|
381 | f = templatekw._showlist('lfs_file', files, args['templ'], args) | |
382 | return templatekw._hybrid(f, files, makemap, pycompat.identity) |
|
382 | return templatekw._hybrid(f, files, makemap, pycompat.identity) | |
383 |
|
383 | |||
384 | @command('debuglfsupload', |
|
384 | @command('debuglfsupload', |
@@ -139,16 +139,16 b' def wraphybridvalue(container, key, valu' | |||||
139 | def showdict(name, data, mapping, plural=None, key='key', value='value', |
|
139 | def showdict(name, data, mapping, plural=None, key='key', value='value', | |
140 | fmt='%s=%s', separator=' '): |
|
140 | fmt='%s=%s', separator=' '): | |
141 | c = [{key: k, value: v} for k, v in data.iteritems()] |
|
141 | c = [{key: k, value: v} for k, v in data.iteritems()] | |
142 | f = _showlist(name, c, mapping, plural, separator) |
|
142 | f = _showlist(name, c, mapping['templ'], mapping, plural, separator) | |
143 | return hybriddict(data, key=key, value=value, fmt=fmt, gen=f) |
|
143 | return hybriddict(data, key=key, value=value, fmt=fmt, gen=f) | |
144 |
|
144 | |||
145 | def showlist(name, values, mapping, plural=None, element=None, separator=' '): |
|
145 | def showlist(name, values, mapping, plural=None, element=None, separator=' '): | |
146 | if not element: |
|
146 | if not element: | |
147 | element = name |
|
147 | element = name | |
148 | f = _showlist(name, values, mapping, plural, separator) |
|
148 | f = _showlist(name, values, mapping['templ'], mapping, plural, separator) | |
149 | return hybridlist(values, name=element, gen=f) |
|
149 | return hybridlist(values, name=element, gen=f) | |
150 |
|
150 | |||
151 | def _showlist(name, values, mapping, plural=None, separator=' '): |
|
151 | def _showlist(name, values, templ, mapping, plural=None, separator=' '): | |
152 | '''expand set of values. |
|
152 | '''expand set of values. | |
153 | name is name of key in template map. |
|
153 | name is name of key in template map. | |
154 | values is list of strings or dicts. |
|
154 | values is list of strings or dicts. | |
@@ -169,7 +169,6 b' def _showlist(name, values, mapping, plu' | |||||
169 |
|
169 | |||
170 | expand 'end_foos'. |
|
170 | expand 'end_foos'. | |
171 | ''' |
|
171 | ''' | |
172 | templ = mapping['templ'] |
|
|||
173 | strmapping = pycompat.strkwargs(mapping) |
|
172 | strmapping = pycompat.strkwargs(mapping) | |
174 | if not plural: |
|
173 | if not plural: | |
175 | plural = name + 's' |
|
174 | plural = name + 's' | |
@@ -383,7 +382,7 b' def showbookmarks(**args):' | |||||
383 | bookmarks = args['ctx'].bookmarks() |
|
382 | bookmarks = args['ctx'].bookmarks() | |
384 | active = repo._activebookmark |
|
383 | active = repo._activebookmark | |
385 | makemap = lambda v: {'bookmark': v, 'active': active, 'current': active} |
|
384 | makemap = lambda v: {'bookmark': v, 'active': active, 'current': active} | |
386 | f = _showlist('bookmark', bookmarks, args) |
|
385 | f = _showlist('bookmark', bookmarks, args['templ'], args) | |
387 | return _hybrid(f, bookmarks, makemap, pycompat.identity) |
|
386 | return _hybrid(f, bookmarks, makemap, pycompat.identity) | |
388 |
|
387 | |||
389 | @templatekeyword('children') |
|
388 | @templatekeyword('children') | |
@@ -455,7 +454,7 b' def showextras(**args):' | |||||
455 | extras = util.sortdict((k, extras[k]) for k in sorted(extras)) |
|
454 | extras = util.sortdict((k, extras[k]) for k in sorted(extras)) | |
456 | makemap = lambda k: {'key': k, 'value': extras[k]} |
|
455 | makemap = lambda k: {'key': k, 'value': extras[k]} | |
457 | c = [makemap(k) for k in extras] |
|
456 | c = [makemap(k) for k in extras] | |
458 | f = _showlist('extra', c, args, plural='extras') |
|
457 | f = _showlist('extra', c, args['templ'], args, plural='extras') | |
459 | return _hybrid(f, extras, makemap, |
|
458 | return _hybrid(f, extras, makemap, | |
460 | lambda k: '%s=%s' % (k, util.escapestr(extras[k]))) |
|
459 | lambda k: '%s=%s' % (k, util.escapestr(extras[k]))) | |
461 |
|
460 | |||
@@ -589,7 +588,7 b' def showlatesttags(pattern, **args):' | |||||
589 | } |
|
588 | } | |
590 |
|
589 | |||
591 | tags = latesttags[2] |
|
590 | tags = latesttags[2] | |
592 | f = _showlist('latesttag', tags, args, separator=':') |
|
591 | f = _showlist('latesttag', tags, args['templ'], args, separator=':') | |
593 | return _hybrid(f, tags, makemap, pycompat.identity) |
|
592 | return _hybrid(f, tags, makemap, pycompat.identity) | |
594 |
|
593 | |||
595 | @templatekeyword('latesttagdistance') |
|
594 | @templatekeyword('latesttagdistance') | |
@@ -674,10 +673,10 b' def shownamespaces(**args):' | |||||
674 |
|
673 | |||
675 | for k, ns in repo.names.iteritems(): |
|
674 | for k, ns in repo.names.iteritems(): | |
676 | names = ns.names(repo, ctx.node()) |
|
675 | names = ns.names(repo, ctx.node()) | |
677 | f = _showlist('name', names, args) |
|
676 | f = _showlist('name', names, args['templ'], args) | |
678 | namespaces[k] = _hybrid(f, names, makensmapfn(ns), pycompat.identity) |
|
677 | namespaces[k] = _hybrid(f, names, makensmapfn(ns), pycompat.identity) | |
679 |
|
678 | |||
680 | f = _showlist('namespace', list(namespaces), args) |
|
679 | f = _showlist('namespace', list(namespaces), args['templ'], args) | |
681 |
|
680 | |||
682 | def makemap(ns): |
|
681 | def makemap(ns): | |
683 | return { |
|
682 | return { | |
@@ -807,7 +806,8 b' def showsuccsandmarkers(repo, ctx, **arg' | |||||
807 |
|
806 | |||
808 | data.append({'successors': successors, 'markers': finalmarkers}) |
|
807 | data.append({'successors': successors, 'markers': finalmarkers}) | |
809 |
|
808 | |||
810 |
|
|
809 | args = pycompat.byteskwargs(args) | |
|
810 | f = _showlist('succsandmarkers', data, args['templ'], args) | |||
811 | return _hybrid(f, data, lambda x: x, pycompat.identity) |
|
811 | return _hybrid(f, data, lambda x: x, pycompat.identity) | |
812 |
|
812 | |||
813 | @templatekeyword('p1rev', requires={'ctx'}) |
|
813 | @templatekeyword('p1rev', requires={'ctx'}) | |
@@ -854,7 +854,7 b' def showparents(**args):' | |||||
854 | ('node', p.hex()), |
|
854 | ('node', p.hex()), | |
855 | ('phase', p.phasestr())] |
|
855 | ('phase', p.phasestr())] | |
856 | for p in pctxs] |
|
856 | for p in pctxs] | |
857 | f = _showlist('parent', parents, args) |
|
857 | f = _showlist('parent', parents, args['templ'], args) | |
858 | return _hybrid(f, prevs, lambda x: {'ctx': repo[x], 'revcache': {}}, |
|
858 | return _hybrid(f, prevs, lambda x: {'ctx': repo[x], 'revcache': {}}, | |
859 | lambda x: scmutil.formatchangeid(repo[x]), keytype=int) |
|
859 | lambda x: scmutil.formatchangeid(repo[x]), keytype=int) | |
860 |
|
860 | |||
@@ -881,7 +881,7 b' def showrevslist(name, revs, **args):' | |||||
881 | be evaluated""" |
|
881 | be evaluated""" | |
882 | args = pycompat.byteskwargs(args) |
|
882 | args = pycompat.byteskwargs(args) | |
883 | repo = args['ctx'].repo() |
|
883 | repo = args['ctx'].repo() | |
884 | f = _showlist(name, ['%d' % r for r in revs], args) |
|
884 | f = _showlist(name, ['%d' % r for r in revs], args['templ'], args) | |
885 | return _hybrid(f, revs, |
|
885 | return _hybrid(f, revs, | |
886 | lambda x: {name: x, 'ctx': repo[x], 'revcache': {}}, |
|
886 | lambda x: {name: x, 'ctx': repo[x], 'revcache': {}}, | |
887 | pycompat.identity, keytype=int) |
|
887 | pycompat.identity, keytype=int) |
General Comments 0
You need to be logged in to leave comments.
Login now