comparison mercurial/ui.py @ 29378:fea71f66ebff

url: remember http password database in ui object This makes http password database stored in ui object. It allows reusing authentication information when we use this database for creating password manager for the new connection.
author liscju <piotr.listkiewicz@gmail.com>
date Thu, 09 Jun 2016 11:41:36 +0200
parents d269e7db2f55
children b62bce819d0c
comparison
equal deleted inserted replaced
29377:2c019aac6b99 29378:fea71f66ebff
26 formatter, 26 formatter,
27 progress, 27 progress,
28 scmutil, 28 scmutil,
29 util, 29 util,
30 ) 30 )
31
32 urlreq = util.urlreq
31 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)
35 [ui] 37 [ui]
122 self._trustgroups = src._trustgroups.copy() 124 self._trustgroups = src._trustgroups.copy()
123 self.environ = src.environ 125 self.environ = src.environ
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
130 self.fin = sys.stdin 134 self.fin = sys.stdin
131 135
133 self.environ = os.environ 137 self.environ = os.environ
134 # we always trust global config files 138 # we always trust global config files
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
141 def resetstate(self): 147 def resetstate(self):
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)
148 155
149 def _trusted(self, fp, f): 156 def _trusted(self, fp, f):