Mercurial > hg
changeset 35722:f18ba40d792f
phabricator: add a template item for linking to a differential review
Differential Revision: https://phab.mercurial-scm.org/D1802
author | Tom Prince <mozilla@hocat.ca> |
---|---|
date | Tue, 02 Jan 2018 10:09:08 -0700 |
parents | f50067fbeead |
children | 50868145a8de |
files | contrib/phabricator.py |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/phabricator.py Sun Jan 14 11:19:45 2018 -0800 +++ b/contrib/phabricator.py Tue Jan 02 10:09:08 2018 -0700 @@ -865,3 +865,17 @@ params = {'objectIdentifier': drev[r'phid'], 'transactions': actions} callconduit(repo, 'differential.revision.edit', params) + +templatekeyword = registrar.templatekeyword() + +@templatekeyword('phabreview') +def template_review(repo, ctx, revcache, **args): + """:phabreview: Object describing the review for this changeset. + Has attributes `url` and `id`. + """ + m = _differentialrevisiondescre.search(ctx.description()) + if m: + return { + 'url': m.group('url'), + 'id': "D{}".format(m.group('id')), + }