Patchwork [08,of,17] configitems: register the 'factotum.executable' config

login
register
mail settings
Submitter Pierre-Yves David
Date July 4, 2017, 11:10 p.m.
Message ID <4ee24ce1d84e61c0845b.1499209836@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21992/
State Accepted
Headers show

Comments

Pierre-Yves David - July 4, 2017, 11:10 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1498786932 -7200
#      Fri Jun 30 03:42:12 2017 +0200
# Node ID 4ee24ce1d84e61c0845bbb93dd806fe23276cfc2
# Parent  c9849bec227a83355e5c12e74abca6f77ce636c4
# EXP-Topic config.register.factorum
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 4ee24ce1d84e
configitems: register the 'factotum.executable' config

Patch

diff --git a/hgext/factotum.py b/hgext/factotum.py
--- a/hgext/factotum.py
+++ b/hgext/factotum.py
@@ -52,6 +52,7 @@  from mercurial.i18n import _
 from mercurial import (
     error,
     httpconnection,
+    registrar,
     url,
     util,
 )
@@ -63,6 +64,13 @@  ERRMAX = 128
 
 _executable = _mountpoint = _service = None
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('factotum', 'executable',
+    default='/bin/auth/factotum',
+)
+
 def auth_getkey(self, params):
     if not self.ui.interactive():
         raise error.Abort(_('factotum not interactive'))
@@ -127,7 +135,7 @@  def find_user_password(self, realm, auth
 
 def uisetup(ui):
     global _executable
-    _executable = ui.config('factotum', 'executable', '/bin/auth/factotum')
+    _executable = ui.config('factotum', 'executable')
     global _mountpoint
     _mountpoint = ui.config('factotum', 'mountpoint', '/mnt/factotum')
     global _service