Patchwork D1802: phabricator: add a template item for linking to a differential review

login
register
mail settings
Submitter phabricator
Date Jan. 15, 2018, 9:58 p.m.
Message ID <39577d1a1615e7f5d88ab04635e7d025@localhost.localdomain>
Download mbox | patch
Permalink /patch/26774/
State Not Applicable
Headers show

Comments

phabricator - Jan. 15, 2018, 9:58 p.m.
tom.prince updated this revision to Diff 4834.
tom.prince retitled this revision from "Add a template item for linking to a differential review." to "phabricator: add a template item for linking to a differential review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1802?vs=4681&id=4834

REVISION DETAIL
  https://phab.mercurial-scm.org/D1802

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS




To: tom.prince, #hg-reviewers, indygreg
Cc: indygreg, pulkit, mercurial-devel

Patch

diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -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')),
+        }