Patchwork D6875: phabricator: use exthelper to register commands, config, and templates

login
register
mail settings
Submitter phabricator
Date Sept. 25, 2019, 5:17 a.m.
Message ID <differential-rev-PHID-DREV-2dbanvk64h5wguhxta2o-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41748/
State Superseded
Headers show

Comments

phabricator - Sept. 25, 2019, 5:17 a.m.
mharbison72 created this revision.
Herald added subscribers: mercurial-devel, Kwan.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: Kwan, mercurial-devel
phabricator - Sept. 25, 2019, 9:21 a.m.
marmoute added a comment.
marmoute accepted this revision.


  This one looks good to me.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6875/new/

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

To: mharbison72, #hg-reviewers, marmoute
Cc: marmoute, Kwan, mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -54,6 +54,7 @@ 
     context,
     encoding,
     error,
+    exthelper,
     httpconnection as httpconnectionmod,
     mdiff,
     obsutil,
@@ -61,7 +62,6 @@ 
     patch,
     phases,
     pycompat,
-    registrar,
     scmutil,
     smartset,
     tags,
@@ -81,30 +81,31 @@ 
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
-cmdtable = {}
-command = registrar.command(cmdtable)
+eh = exthelper.exthelper()
 
-configtable = {}
-configitem = registrar.configitem(configtable)
+cmdtable = eh.cmdtable
+command = eh.command
+configtable = eh.configtable
+templatekeyword = eh.templatekeyword
 
 # developer config: phabricator.batchsize
-configitem(b'phabricator', b'batchsize',
+eh.configitem(b'phabricator', b'batchsize',
     default=12,
 )
-configitem(b'phabricator', b'callsign',
+eh.configitem(b'phabricator', b'callsign',
     default=None,
 )
-configitem(b'phabricator', b'curlcmd',
+eh.configitem(b'phabricator', b'curlcmd',
     default=None,
 )
 # developer config: phabricator.repophid
-configitem(b'phabricator', b'repophid',
+eh.configitem(b'phabricator', b'repophid',
     default=None,
 )
-configitem(b'phabricator', b'url',
+eh.configitem(b'phabricator', b'url',
     default=None,
 )
-configitem(b'phabsend', b'confirm',
+eh.configitem(b'phabsend', b'confirm',
     default=False,
 )
 
@@ -1064,9 +1065,7 @@ 
                       b'transactions': actions}
             callconduit(ui, b'differential.revision.edit', params)
 
-templatekeyword = registrar.templatekeyword()
-
-@templatekeyword(b'phabreview', requires={b'ctx'})
+@eh.templatekeyword(b'phabreview', requires={b'ctx'})
 def template_review(context, mapping):
     """:phabreview: Object describing the review for this changeset.
     Has attributes `url` and `id`.