# HG changeset patch # User Tom Prince # Date 2018-01-02 17:09:08 # Node ID f18ba40d792f51c65c262d471eef7ddef252c3f4 # Parent f50067fbeead45eb91f1caf92843b46930d06d00 phabricator: add a template item for linking to a differential review Differential Revision: https://phab.mercurial-scm.org/D1802 diff --git a/contrib/phabricator.py b/contrib/phabricator.py --- a/contrib/phabricator.py +++ b/contrib/phabricator.py @@ -865,3 +865,17 @@ def phabupdate(ui, repo, spec, **opts): 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')), + }