##// END OF EJS Templates
url: remember http password database in ui object...
liscju -
r29378:fea71f66 default
parent child Browse files
Show More
@@ -29,6 +29,8 b' from . import ('
29 util,
29 util,
30 )
30 )
31
31
32 urlreq = util.urlreq
33
32 samplehgrcs = {
34 samplehgrcs = {
33 'user':
35 'user':
34 """# example user config (see "hg help config" for more info)
36 """# example user config (see "hg help config" for more info)
@@ -124,6 +126,8 b' class ui(object):'
124 self.callhooks = src.callhooks
126 self.callhooks = src.callhooks
125 self.insecureconnections = src.insecureconnections
127 self.insecureconnections = src.insecureconnections
126 self.fixconfig()
128 self.fixconfig()
129
130 self.httppasswordmgrdb = src.httppasswordmgrdb
127 else:
131 else:
128 self.fout = sys.stdout
132 self.fout = sys.stdout
129 self.ferr = sys.stderr
133 self.ferr = sys.stderr
@@ -135,6 +139,8 b' class ui(object):'
135 for f in scmutil.rcpath():
139 for f in scmutil.rcpath():
136 self.readconfig(f, trust=True)
140 self.readconfig(f, trust=True)
137
141
142 self.httppasswordmgrdb = urlreq.httppasswordmgrwithdefaultrealm()
143
138 def copy(self):
144 def copy(self):
139 return self.__class__(self)
145 return self.__class__(self)
140
146
@@ -142,6 +148,7 b' class ui(object):'
142 """Clear internal state that shouldn't persist across commands"""
148 """Clear internal state that shouldn't persist across commands"""
143 if self._progbar:
149 if self._progbar:
144 self._progbar.resetstate() # reset last-print time of progress bar
150 self._progbar.resetstate() # reset last-print time of progress bar
151 self.httppasswordmgrdb = urlreq.httppasswordmgrwithdefaultrealm()
145
152
146 def formatter(self, topic, opts):
153 def formatter(self, topic, opts):
147 return formatter.formatter(self, topic, opts)
154 return formatter.formatter(self, topic, opts)
@@ -365,7 +365,7 b' if has_https:'
365 urlreq.httpshandler.__init__(self)
365 urlreq.httpshandler.__init__(self)
366 self.ui = ui
366 self.ui = ui
367 self.pwmgr = passwordmgr(self.ui,
367 self.pwmgr = passwordmgr(self.ui,
368 urlreq.httppasswordmgrwithdefaultrealm())
368 self.ui.httppasswordmgrdb)
369
369
370 def _start_transaction(self, h, req):
370 def _start_transaction(self, h, req):
371 _generic_start_transaction(self, h, req)
371 _generic_start_transaction(self, h, req)
@@ -482,7 +482,7 b' def opener(ui, authinfo=None):'
482 handlers = [
482 handlers = [
483 httpconnectionmod.http2handler(
483 httpconnectionmod.http2handler(
484 ui,
484 ui,
485 passwordmgr(ui, urlreq.httppasswordmgrwithdefaultrealm()))
485 passwordmgr(ui, ui.httppasswordmgrdb))
486 ]
486 ]
487 else:
487 else:
488 handlers = [httphandler()]
488 handlers = [httphandler()]
@@ -491,7 +491,7 b' def opener(ui, authinfo=None):'
491
491
492 handlers.append(proxyhandler(ui))
492 handlers.append(proxyhandler(ui))
493
493
494 passmgr = passwordmgr(ui, urlreq.httppasswordmgrwithdefaultrealm())
494 passmgr = passwordmgr(ui, ui.httppasswordmgrdb)
495 if authinfo is not None:
495 if authinfo is not None:
496 passmgr.add_password(*authinfo)
496 passmgr.add_password(*authinfo)
497 user, passwd = authinfo[2:4]
497 user, passwd = authinfo[2:4]
General Comments 0
You need to be logged in to leave comments. Login now