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

login
register
mail settings
Submitter phabricator
Date Jan. 18, 2018, 7:58 p.m.
Message ID <0c1c4ce13884d349b173fd67ebeea0f6@localhost.localdomain>
Download mbox | patch
Permalink /patch/26929/
State Not Applicable
Headers show

Comments

phabricator - Jan. 18, 2018, 7:58 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf18ba40d792f: phabricator: add a template item for linking to a differential review (authored by tom.prince, committed by ).

REPOSITORY
  rHG Mercurial

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

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

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS




To: tom.prince, #hg-reviewers, indygreg, durin42
Cc: durin42, 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')),
+        }