diff -r 113d0b23321a -r 2c019aac6b99 mercurial/url.py --- a/mercurial/url.py Wed Jun 01 22:58:57 2016 +0200 +++ b/mercurial/url.py Sun Jun 05 23:36:23 2016 +0200 @@ -27,14 +27,16 @@ urlerr = util.urlerr urlreq = util.urlreq -class passwordmgr(urlreq.httppasswordmgrwithdefaultrealm): - def __init__(self, ui): - urlreq.httppasswordmgrwithdefaultrealm.__init__(self) +class passwordmgr(object): + def __init__(self, ui, passwddb): self.ui = ui + self.passwddb = passwddb + + def add_password(self, realm, uri, user, passwd): + return self.passwddb.add_password(realm, uri, user, passwd) def find_user_password(self, realm, authuri): - authinfo = urlreq.httppasswordmgrwithdefaultrealm.find_user_password( - self, realm, authuri) + authinfo = self.passwddb.find_user_password(realm, authuri) user, passwd = authinfo if user and passwd: self._writedebug(user, passwd) @@ -64,7 +66,7 @@ if not passwd: passwd = self.ui.getpass() - self.add_password(realm, authuri, user, passwd) + self.passwddb.add_password(realm, authuri, user, passwd) self._writedebug(user, passwd) return (user, passwd) @@ -73,8 +75,7 @@ self.ui.debug(msg % (user, passwd and '*' * len(passwd) or 'not set')) def find_stored_password(self, authuri): - return urlreq.httppasswordmgrwithdefaultrealm.find_user_password( - self, None, authuri) + return self.passwddb.find_user_password(None, authuri) class proxyhandler(urlreq.proxyhandler): def __init__(self, ui): @@ -363,7 +364,8 @@ keepalive.KeepAliveHandler.__init__(self) urlreq.httpshandler.__init__(self) self.ui = ui - self.pwmgr = passwordmgr(self.ui) + self.pwmgr = passwordmgr(self.ui, + urlreq.httppasswordmgrwithdefaultrealm()) def _start_transaction(self, h, req): _generic_start_transaction(self, h, req) @@ -477,7 +479,11 @@ ''' # experimental config: ui.usehttp2 if ui.configbool('ui', 'usehttp2', False): - handlers = [httpconnectionmod.http2handler(ui, passwordmgr(ui))] + handlers = [ + httpconnectionmod.http2handler( + ui, + passwordmgr(ui, urlreq.httppasswordmgrwithdefaultrealm())) + ] else: handlers = [httphandler()] if has_https: @@ -485,7 +491,7 @@ handlers.append(proxyhandler(ui)) - passmgr = passwordmgr(ui) + passmgr = passwordmgr(ui, urlreq.httppasswordmgrwithdefaultrealm()) if authinfo is not None: passmgr.add_password(*authinfo) user, passwd = authinfo[2:4]