comparison mercurial/templatekw.py @ 36595:2da414105809

templatekw: switch revset() to new API
author Yuya Nishihara <yuya@tcha.org>
date Sun, 25 Feb 2018 19:08:02 +0900
parents 59ee648870a7
children b5d39a09656a
comparison
equal deleted inserted replaced
36594:59ee648870a7 36595:2da414105809
901 def showrev(context, mapping): 901 def showrev(context, mapping):
902 """Integer. The repository-local changeset revision number.""" 902 """Integer. The repository-local changeset revision number."""
903 ctx = context.resource(mapping, 'ctx') 903 ctx = context.resource(mapping, 'ctx')
904 return scmutil.intrev(ctx) 904 return scmutil.intrev(ctx)
905 905
906 def showrevslist(name, revs, **args): 906 def showrevslist(context, mapping, name, revs):
907 """helper to generate a list of revisions in which a mapped template will 907 """helper to generate a list of revisions in which a mapped template will
908 be evaluated""" 908 be evaluated"""
909 args = pycompat.byteskwargs(args) 909 repo = context.resource(mapping, 'repo')
910 repo = args['ctx'].repo() 910 templ = context.resource(mapping, 'templ')
911 f = _showlist(name, ['%d' % r for r in revs], args['templ'], args) 911 f = _showlist(name, ['%d' % r for r in revs], templ, mapping)
912 return _hybrid(f, revs, 912 return _hybrid(f, revs,
913 lambda x: {name: x, 'ctx': repo[x], 'revcache': {}}, 913 lambda x: {name: x, 'ctx': repo[x], 'revcache': {}},
914 pycompat.identity, keytype=int) 914 pycompat.identity, keytype=int)
915 915
916 @templatekeyword('subrepos', requires={'ctx', 'templ'}) 916 @templatekeyword('subrepos', requires={'ctx', 'templ'})