Mercurial > public > mercurial-scm > hg-stable
diff hgext/factotum.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | c31ce080eb75 |
children | 687b865b95ad |
line wrap: on
line diff
--- 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')