##// 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 if self._hasnodespec(origmapping) and self._hasnodespec(newmapping):
579 if self._hasnodespec(origmapping) and self._hasnodespec(newmapping):
580 orignode = templateutil.runsymbol(context, origmapping, 'node')
580 orignode = templateutil.runsymbol(context, origmapping, 'node')
581 mapping['originalnode'] = orignode
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 # its existence to be reported by availablekeys()
583 # its existence to be reported by availablekeys()
584 if 'ctx' not in newmapping and self._hasliteral(newmapping, 'node'):
585 mapping['ctx'] = _placeholder
584 if 'fctx' not in newmapping and self._hasliteral(newmapping, 'path'):
586 if 'fctx' not in newmapping and self._hasliteral(newmapping, 'path'):
585 mapping['fctx'] = _placeholder
587 mapping['fctx'] = _placeholder
586 return mapping
588 return mapping
@@ -606,6 +608,16 b' class templateresources(templater.resour'
606 """Test if context revision is set or unset in the given mapping"""
608 """Test if context revision is set or unset in the given mapping"""
607 return 'node' in mapping or 'ctx' in mapping
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 def _loadfctx(self, mapping):
621 def _loadfctx(self, mapping):
610 ctx = self._getsome(mapping, 'ctx')
622 ctx = self._getsome(mapping, 'ctx')
611 path = self._getliteral(mapping, 'path')
623 path = self._getliteral(mapping, 'path')
@@ -617,6 +629,7 b' class templateresources(templater.resour'
617 return None # maybe removed file?
629 return None # maybe removed file?
618
630
619 _loadermap = {
631 _loadermap = {
632 'ctx': _loadctx,
620 'fctx': _loadfctx,
633 'fctx': _loadfctx,
621 }
634 }
622
635
@@ -481,8 +481,6 b' def showmanifest(context, mapping):'
481 mhex = hex(mnode)
481 mhex = hex(mnode)
482 mapping = context.overlaymap(mapping, {'rev': mrev, 'node': mhex})
482 mapping = context.overlaymap(mapping, {'rev': mrev, 'node': mhex})
483 f = context.process('manifest', mapping)
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 return templateutil.hybriditem(f, None, f,
484 return templateutil.hybriditem(f, None, f,
487 lambda x: {'rev': mrev, 'node': mhex})
485 lambda x: {'rev': mrev, 'node': mhex})
488
486
@@ -58,6 +58,11 b' never cause crash:'
58 $ hg log -r 'wdir()' -T '{manifest}\n'
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 Check that {phase} works correctly on parents:
66 Check that {phase} works correctly on parents:
62
67
63 $ cat << EOF > parentphase
68 $ cat << EOF > parentphase
@@ -1756,5 +1756,5 b' Test recursive showlist template (issue1'
1756
1756
1757 $ hg -R latesttag log -r tip --style=style1989
1757 $ hg -R latesttag log -r tip --style=style1989
1758 M|test
1758 M|test
1759 11,test
1759 11,
1760 branch: test
1760 branch: test
General Comments 0
You need to be logged in to leave comments. Login now