Show More
@@ -554,17 +554,16 b' class templateresources(templater.resour' | |||||
554 | } |
|
554 | } | |
555 |
|
555 | |||
556 | def availablekeys(self, mapping): |
|
556 | def availablekeys(self, mapping): | |
557 |
return {k for k |
|
557 | return {k for k in self.knownkeys() | |
558 |
if g( |
|
558 | if self._getsome(mapping, k) is not None} | |
559 |
|
559 | |||
560 | def knownkeys(self): |
|
560 | def knownkeys(self): | |
561 | return self._knownkeys |
|
561 | return {'cache', 'ctx', 'fctx', 'repo', 'revcache', 'ui'} | |
562 |
|
562 | |||
563 | def lookup(self, mapping, key): |
|
563 | def lookup(self, mapping, key): | |
564 | get = self._gettermap.get(key) |
|
564 | if key not in self.knownkeys(): | |
565 | if not get: |
|
|||
566 | return None |
|
565 | return None | |
567 |
return get( |
|
566 | return self._getsome(mapping, key) | |
568 |
|
567 | |||
569 | def populatemap(self, context, origmapping, newmapping): |
|
568 | def populatemap(self, context, origmapping, newmapping): | |
570 | mapping = {} |
|
569 | mapping = {} | |
@@ -585,16 +584,6 b' class templateresources(templater.resour' | |||||
585 | def _hasctx(self, mapping): |
|
584 | def _hasctx(self, mapping): | |
586 | return 'ctx' in mapping |
|
585 | return 'ctx' in mapping | |
587 |
|
586 | |||
588 | _gettermap = { |
|
|||
589 | 'cache': _getsome, |
|
|||
590 | 'ctx': _getsome, |
|
|||
591 | 'fctx': _getsome, |
|
|||
592 | 'repo': _getsome, |
|
|||
593 | 'revcache': _getsome, |
|
|||
594 | 'ui': _getsome, |
|
|||
595 | } |
|
|||
596 | _knownkeys = set(_gettermap.keys()) |
|
|||
597 |
|
||||
598 | def formatter(ui, out, topic, opts): |
|
587 | def formatter(ui, out, topic, opts): | |
599 | template = opts.get("template", "") |
|
588 | template = opts.get("template", "") | |
600 | if template == "json": |
|
589 | if template == "json": |
General Comments 0
You need to be logged in to leave comments.
Login now