changeset 42975:24bf7a3d3c30

phabricator: use exthelper to register commands, config, and templates Differential Revision: https://phab.mercurial-scm.org/D6875
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 24 Sep 2019 22:41:07 -0400
parents 71bb9363818c
children 576fd1c8b20b
files hgext/phabricator.py
diffstat 1 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/phabricator.py	Wed Sep 25 11:04:08 2019 -0400
+++ b/hgext/phabricator.py	Tue Sep 24 22:41:07 2019 -0400
@@ -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`.