##// END OF EJS Templates
formatter: factor out function that detects node change and document it...
Yuya Nishihara -
r39621:990a0b07 default
parent child Browse files
Show More
@@ -567,10 +567,9 b' class templateresources(templater.resour'
567
567
568 def populatemap(self, context, origmapping, newmapping):
568 def populatemap(self, context, origmapping, newmapping):
569 mapping = {}
569 mapping = {}
570 if self._hasctx(newmapping):
570 if self._hasnodespec(newmapping):
571 mapping['revcache'] = {} # per-ctx cache
571 mapping['revcache'] = {} # per-ctx cache
572 if (('node' in origmapping or self._hasctx(origmapping))
572 if self._hasnodespec(origmapping) and self._hasnodespec(newmapping):
573 and ('node' in newmapping or self._hasctx(newmapping))):
574 orignode = templateutil.runsymbol(context, origmapping, 'node')
573 orignode = templateutil.runsymbol(context, origmapping, 'node')
575 mapping['originalnode'] = orignode
574 mapping['originalnode'] = orignode
576 return mapping
575 return mapping
@@ -581,8 +580,9 b' class templateresources(templater.resour'
581 return v
580 return v
582 return self._resmap.get(key)
581 return self._resmap.get(key)
583
582
584 def _hasctx(self, mapping):
583 def _hasnodespec(self, mapping):
585 return 'ctx' in mapping
584 """Test if context revision is set or unset in the given mapping"""
585 return 'node' in mapping or 'ctx' in mapping
586
586
587 def formatter(ui, out, topic, opts):
587 def formatter(ui, out, topic, opts):
588 template = opts.get("template", "")
588 template = opts.get("template", "")
General Comments 0
You need to be logged in to leave comments. Login now