Mercurial > hg
comparison mercurial/formatter.py @ 37104:7db3c28dfdfd
formatter: port handling of 'originalnode' to populatemap() hook
This isn't a pure templating business, so let's move out of the templater
module.
Note that this works only in web templates where mapping['node'] is a static
value.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 17 Mar 2018 17:41:07 +0900 |
parents | be3f33f5e232 |
children | e7bc0667c521 |
comparison
equal
deleted
inserted
replaced
37103:be3f33f5e232 | 37104:7db3c28dfdfd |
---|---|
512 | 512 |
513 def populatemap(self, context, origmapping, newmapping): | 513 def populatemap(self, context, origmapping, newmapping): |
514 mapping = {} | 514 mapping = {} |
515 if self._hasctx(newmapping): | 515 if self._hasctx(newmapping): |
516 mapping['revcache'] = {} # per-ctx cache | 516 mapping['revcache'] = {} # per-ctx cache |
517 if 'node' in origmapping and 'node' in newmapping: | |
518 mapping['originalnode'] = origmapping['node'] | |
517 return mapping | 519 return mapping |
518 | 520 |
519 def _getsome(self, context, mapping, key): | 521 def _getsome(self, context, mapping, key): |
520 v = mapping.get(key) | 522 v = mapping.get(key) |
521 if v is not None: | 523 if v is not None: |