[PATCH 1 of 3] http: plugable passwordmgr instance
Markus Zapke-Gründemann
markuszapke at gmx.net
Fri Aug 24 04:40:17 CDT 2012
# HG changeset patch
# User Markus Zapke-Gründemann <markus at keimlink.de>
# Date 1345799200 -7200
# Node ID 16bb1c7b869f50fe09a62062fe0b7b5e0679b6ba
# Parent a0cf8f4cd38ba8c35132379b680ebf6d0e900e3d
http: plugable passwordmgr instance
Allows to replace the passwordmgr with a different implementation.
diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -317,6 +317,8 @@ class httphandler(keepalive.HTTPHandler)
_generic_start_transaction(self, h, req)
return keepalive.HTTPHandler._start_transaction(self, h, req)
+pwmgrclass = passwordmgr
+
if has_https:
class httpsconnection(httplib.HTTPSConnection):
response_class = keepalive.HTTPResponse
@@ -341,7 +343,7 @@ if has_https:
keepalive.KeepAliveHandler.__init__(self)
urllib2.HTTPSHandler.__init__(self)
self.ui = ui
- self.pwmgr = passwordmgr(self.ui)
+ self.pwmgr = pwmgrclass(ui)
def _start_transaction(self, h, req):
_generic_start_transaction(self, h, req)
@@ -437,7 +439,7 @@ def opener(ui, authinfo=None):
authinfo will be added to the password manager
'''
if ui.configbool('ui', 'usehttp2', False):
- handlers = [httpconnectionmod.http2handler(ui, passwordmgr(ui))]
+ handlers = [httpconnectionmod.http2handler(ui, pwmgrclass(ui))]
else:
handlers = [httphandler()]
if has_https:
@@ -445,7 +447,7 @@ def opener(ui, authinfo=None):
handlers.append(proxyhandler(ui))
- passmgr = passwordmgr(ui)
+ passmgr = pwmgrclass(ui)
if authinfo is not None:
passmgr.add_password(*authinfo)
user, passwd = authinfo[2:4]
More information about the Mercurial-devel
mailing list