--- a/hgext/factotum.py Sat Oct 05 10:29:34 2019 -0400
+++ b/hgext/factotum.py Sun Oct 06 09:45:02 2019 -0400
@@ -49,9 +49,7 @@
import os
from mercurial.i18n import _
-from mercurial.utils import (
- procutil,
-)
+from mercurial.utils import procutil
from mercurial import (
error,
httpconnection,
@@ -70,16 +68,17 @@
configtable = {}
configitem = registrar.configitem(configtable)
-configitem('factotum', 'executable',
- default='/bin/auth/factotum',
+configitem(
+ 'factotum', 'executable', default='/bin/auth/factotum',
)
-configitem('factotum', 'mountpoint',
- default='/mnt/factotum',
+configitem(
+ 'factotum', 'mountpoint', default='/mnt/factotum',
)
-configitem('factotum', 'service',
- default='hg',
+configitem(
+ 'factotum', 'service', default='hg',
)
+
def auth_getkey(self, params):
if not self.ui.interactive():
raise error.Abort(_('factotum not interactive'))
@@ -88,6 +87,7 @@
params = '%s !password?' % params
os.system(procutil.tonativestr("%s -g '%s'" % (_executable, params)))
+
def auth_getuserpasswd(self, getkey, params):
params = 'proto=pass %s' % params
while True:
@@ -111,12 +111,15 @@
os.close(fd)
getkey(self, params)
+
def monkeypatch_method(cls):
def decorator(func):
setattr(cls, func.__name__, func)
return func
+
return decorator
+
@monkeypatch_method(passwordmgr)
def find_user_password(self, realm, authuri):
user, passwd = self.passwddb.find_user_password(realm, authuri)
@@ -142,6 +145,7 @@
self._writedebug(user, passwd)
return (user, passwd)
+
def uisetup(ui):
global _executable
_executable = ui.config('factotum', 'executable')