Show More
@@ -135,6 +135,15 b' b"""# example system-wide hg config (see' | |||
|
135 | 135 | """, |
|
136 | 136 | } |
|
137 | 137 | |
|
138 | def _maybestrurl(maybebytes): | |
|
139 | if maybebytes is None: | |
|
140 | return None | |
|
141 | return pycompat.strurl(maybebytes) | |
|
142 | ||
|
143 | def _maybebytesurl(maybestr): | |
|
144 | if maybestr is None: | |
|
145 | return None | |
|
146 | return pycompat.bytesurl(maybestr) | |
|
138 | 147 | |
|
139 | 148 | class httppasswordmgrdbproxy(object): |
|
140 | 149 | """Delays loading urllib2 until it's needed.""" |
@@ -147,10 +156,18 b' class httppasswordmgrdbproxy(object):' | |||
|
147 | 156 | return self._mgr |
|
148 | 157 | |
|
149 | 158 | def add_password(self, realm, uris, user, passwd): |
|
150 | return self._get_mgr().add_password(realm, uris, user, passwd) | |
|
159 | if isinstance(uris, tuple): | |
|
160 | uris = tuple(_maybestrurl(u) for u in uris) | |
|
161 | else: | |
|
162 | uris = _maybestrurl(uris) | |
|
163 | return self._get_mgr().add_password( | |
|
164 | _maybestrurl(realm), uris, | |
|
165 | _maybestrurl(user), _maybestrurl(passwd)) | |
|
151 | 166 | |
|
152 | 167 | def find_user_password(self, realm, uri): |
|
153 | return self._get_mgr().find_user_password(realm, uri) | |
|
168 | return tuple(_maybebytesurl(v) for v in | |
|
169 | self._get_mgr().find_user_password(_maybestrurl(realm), | |
|
170 | _maybestrurl(uri))) | |
|
154 | 171 | |
|
155 | 172 | def _catchterm(*args): |
|
156 | 173 | raise error.SignalInterrupt |
General Comments 0
You need to be logged in to leave comments.
Login now