comparison contrib/phabricator.py @ 36514:7b74afec6772

templatekw: switch non-showlist template keywords to new API
author Yuya Nishihara <yuya@tcha.org>
date Sun, 25 Feb 2018 13:40:46 +0900
parents f18ba40d792f
children 4397909f82d3
comparison
equal deleted inserted replaced
36513:6ad140dc4269 36514:7b74afec6772
866 'transactions': actions} 866 'transactions': actions}
867 callconduit(repo, 'differential.revision.edit', params) 867 callconduit(repo, 'differential.revision.edit', params)
868 868
869 templatekeyword = registrar.templatekeyword() 869 templatekeyword = registrar.templatekeyword()
870 870
871 @templatekeyword('phabreview') 871 @templatekeyword('phabreview', requires={'ctx'})
872 def template_review(repo, ctx, revcache, **args): 872 def template_review(context, mapping):
873 """:phabreview: Object describing the review for this changeset. 873 """:phabreview: Object describing the review for this changeset.
874 Has attributes `url` and `id`. 874 Has attributes `url` and `id`.
875 """ 875 """
876 ctx = context.resource(mapping, 'ctx')
876 m = _differentialrevisiondescre.search(ctx.description()) 877 m = _differentialrevisiondescre.search(ctx.description())
877 if m: 878 if m:
878 return { 879 return {
879 'url': m.group('url'), 880 'url': m.group('url'),
880 'id': "D{}".format(m.group('id')), 881 'id': "D{}".format(m.group('id')),