D1802: Add a template item for linking to a differential review.

2018-01-14 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added a comment.
This revision now requires changes to proceed.


  Please also remove the double newlines and fix the commit message to abide by 
our message standards.
  
  From the `tests`/ directory, run `./run-tests.py -j8 test-check-*` to run the 
static analysis checks.

INLINE COMMENTS

> phabricator.py:871-872
> +
> +def extsetup(ui):
> +templatekw.keywords['phabreview'] = template_review
> +

`registrar.templatekeyword()` returns a function that can be used as a 
decorator. This is the preferred mechanism to define templates in extensions. 
See `hgext/transplant.py` for a simple example.

Please switch to that API.

REPOSITORY
  rHG Mercurial

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

To: tom.prince, #hg-reviewers, indygreg
Cc: indygreg, pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1802: Add a template item for linking to a differential review.

2018-01-10 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> phabricator.py:873
> +templatekw.keywords['phabreview'] = template_review
> +
> +

couple of new lines here and above too, did you ran test-check-commit.t?

REPOSITORY
  rHG Mercurial

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

To: tom.prince, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1802: Add a template item for linking to a differential review.

2018-01-02 Thread tom.prince (Tom Prince)
tom.prince created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS

diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -57,6 +57,7 @@
 scmutil,
 smartset,
 tags,
+templatekw,
 url as urlmod,
 util,
 )
@@ -865,3 +866,19 @@
 params = {'objectIdentifier': drev[r'phid'],
   'transactions': actions}
 callconduit(repo, 'differential.revision.edit', params)
+
+
+def extsetup(ui):
+templatekw.keywords['phabreview'] = template_review
+
+
+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')),
+}



To: tom.prince, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel