##// END OF EJS Templates
templatekw: add {size} keyword as an example of fctx-based keyword...
Yuya Nishihara -
r39623:918944f5 default
parent child Browse files
Show More
@@ -582,6 +582,12 b' def showreporoot(context, mapping):'
582 repo = context.resource(mapping, 'repo')
582 repo = context.resource(mapping, 'repo')
583 return repo.root
583 return repo.root
584
584
585 @templatekeyword('size', requires={'fctx'})
586 def showsize(context, mapping):
587 """Integer. Size of the current file in bytes. (EXPERIMENTAL)"""
588 fctx = context.resource(mapping, 'fctx')
589 return fctx.size()
590
585 @templatekeyword("successorssets", requires={'repo', 'ctx'})
591 @templatekeyword("successorssets", requires={'repo', 'ctx'})
586 def showsuccessorssets(context, mapping):
592 def showsuccessorssets(context, mapping):
587 """Returns a string of sets of successors for a changectx. Format used
593 """Returns a string of sets of successors for a changectx. Format used
@@ -787,6 +787,15 b' Test file copies dict:'
787 $ hg log -r8 -C -T '{file_copies_switch % "{path} <- {source}\n"}'
787 $ hg log -r8 -C -T '{file_copies_switch % "{path} <- {source}\n"}'
788 fourth <- second
788 fourth <- second
789
789
790 Test file attributes:
791
792 $ hg log -l1 -T '{files % "{pad(size, 3, left=True)} {path}\n"}'
793 a
794 0 b
795 7 fifth
796 fourth
797 13 third
798
790 Test index keyword:
799 Test index keyword:
791
800
792 $ hg log -l 2 -T '{index + 10}{files % " {index}:{file}"}\n'
801 $ hg log -l 2 -T '{index + 10}{files % " {index}:{file}"}\n'
General Comments 0
You need to be logged in to leave comments. Login now