Show More
@@ -31,7 +31,6 b' from .utils import (' | |||||
31 | ) |
|
31 | ) | |
32 |
|
32 | |||
33 | _hybrid = templateutil.hybrid |
|
33 | _hybrid = templateutil.hybrid | |
34 | _mappable = templateutil.mappable |
|
|||
35 | hybriddict = templateutil.hybriddict |
|
34 | hybriddict = templateutil.hybriddict | |
36 | hybridlist = templateutil.hybridlist |
|
35 | hybridlist = templateutil.hybridlist | |
37 | compatdict = templateutil.compatdict |
|
36 | compatdict = templateutil.compatdict | |
@@ -469,7 +468,8 b' def showmanifest(context, mapping):' | |||||
469 | f = context.process('manifest', mapping) |
|
468 | f = context.process('manifest', mapping) | |
470 | # TODO: perhaps 'ctx' should be dropped from mapping because manifest |
|
469 | # TODO: perhaps 'ctx' should be dropped from mapping because manifest | |
471 | # rev and node are completely different from changeset's. |
|
470 | # rev and node are completely different from changeset's. | |
472 | return _mappable(f, None, f, lambda x: {'rev': mrev, 'node': mhex}) |
|
471 | return templateutil.hybriditem(f, None, f, | |
|
472 | lambda x: {'rev': mrev, 'node': mhex}) | |||
473 |
|
473 | |||
474 | @templatekeyword('obsfate', requires={'ui', 'repo', 'ctx'}) |
|
474 | @templatekeyword('obsfate', requires={'ui', 'repo', 'ctx'}) | |
475 | def showobsfate(context, mapping): |
|
475 | def showobsfate(context, mapping): |
@@ -42,7 +42,7 b' hybrid' | |||||
42 | represents a list/dict of printable values, which can also be converted |
|
42 | represents a list/dict of printable values, which can also be converted | |
43 | to mappings by % operator. |
|
43 | to mappings by % operator. | |
44 |
|
44 | |||
45 | mappable |
|
45 | hybriditem | |
46 | represents a scalar printable value, also supports % operator. |
|
46 | represents a scalar printable value, also supports % operator. | |
47 |
|
47 | |||
48 | mappinggenerator, mappinglist |
|
48 | mappinggenerator, mappinglist |
@@ -215,7 +215,7 b' class hybrid(wrapped):' | |||||
215 | if util.safehasattr(val, '_makemap'): |
|
215 | if util.safehasattr(val, '_makemap'): | |
216 | # a nested hybrid list/dict, which has its own way of map operation |
|
216 | # a nested hybrid list/dict, which has its own way of map operation | |
217 | return val |
|
217 | return val | |
218 |
return |
|
218 | return hybriditem(None, key, val, self._makemap) | |
219 |
|
219 | |||
220 | def itermaps(self, context): |
|
220 | def itermaps(self, context): | |
221 | makemap = self._makemap |
|
221 | makemap = self._makemap | |
@@ -243,7 +243,7 b' class hybrid(wrapped):' | |||||
243 | for k, v in xs.iteritems()} |
|
243 | for k, v in xs.iteritems()} | |
244 | return [unwrapvalue(context, mapping, x) for x in xs] |
|
244 | return [unwrapvalue(context, mapping, x) for x in xs] | |
245 |
|
245 | |||
246 |
class |
|
246 | class hybriditem(wrapped): | |
247 | """Wrapper for non-list/dict object to support map operation |
|
247 | """Wrapper for non-list/dict object to support map operation | |
248 |
|
248 | |||
249 | This class allows us to handle both: |
|
249 | This class allows us to handle both: |
General Comments 0
You need to be logged in to leave comments.
Login now