##// END OF EJS Templates
formatter: populate ctx from repo and node value...
Yuya Nishihara -
r39659:34ecc0a0 default
parent child Browse files
Show More
@@ -579,8 +579,10 b' class templateresources(templater.resour'
579 579 if self._hasnodespec(origmapping) and self._hasnodespec(newmapping):
580 580 orignode = templateutil.runsymbol(context, origmapping, 'node')
581 581 mapping['originalnode'] = orignode
582 # put marker to override 'fctx' in mapping if any, and flag
582 # put marker to override 'ctx'/'fctx' in mapping if any, and flag
583 583 # its existence to be reported by availablekeys()
584 if 'ctx' not in newmapping and self._hasliteral(newmapping, 'node'):
585 mapping['ctx'] = _placeholder
584 586 if 'fctx' not in newmapping and self._hasliteral(newmapping, 'path'):
585 587 mapping['fctx'] = _placeholder
586 588 return mapping
@@ -606,6 +608,16 b' class templateresources(templater.resour'
606 608 """Test if context revision is set or unset in the given mapping"""
607 609 return 'node' in mapping or 'ctx' in mapping
608 610
611 def _loadctx(self, mapping):
612 repo = self._getsome(mapping, 'repo')
613 node = self._getliteral(mapping, 'node')
614 if repo is None or node is None:
615 return
616 try:
617 return repo[node]
618 except error.RepoLookupError:
619 return None # maybe hidden/non-existent node
620
609 621 def _loadfctx(self, mapping):
610 622 ctx = self._getsome(mapping, 'ctx')
611 623 path = self._getliteral(mapping, 'path')
@@ -617,6 +629,7 b' class templateresources(templater.resour'
617 629 return None # maybe removed file?
618 630
619 631 _loadermap = {
632 'ctx': _loadctx,
620 633 'fctx': _loadfctx,
621 634 }
622 635
@@ -481,8 +481,6 b' def showmanifest(context, mapping):'
481 481 mhex = hex(mnode)
482 482 mapping = context.overlaymap(mapping, {'rev': mrev, 'node': mhex})
483 483 f = context.process('manifest', mapping)
484 # TODO: perhaps 'ctx' should be dropped from mapping because manifest
485 # rev and node are completely different from changeset's.
486 484 return templateutil.hybriditem(f, None, f,
487 485 lambda x: {'rev': mrev, 'node': mhex})
488 486
@@ -58,6 +58,11 b' never cause crash:'
58 58 $ hg log -r 'wdir()' -T '{manifest}\n'
59 59
60 60
61 Changectx-derived keywords are disabled within {manifest} as {node} changes:
62
63 $ hg log -r0 -T 'outer:{p1node} {manifest % "inner:{p1node}"}\n'
64 outer:0000000000000000000000000000000000000000 inner:
65
61 66 Check that {phase} works correctly on parents:
62 67
63 68 $ cat << EOF > parentphase
@@ -1756,5 +1756,5 b' Test recursive showlist template (issue1'
1756 1756
1757 1757 $ hg -R latesttag log -r tip --style=style1989
1758 1758 M|test
1759 11,test
1759 11,
1760 1760 branch: test
General Comments 0
You need to be logged in to leave comments. Login now