Show More
@@ -184,12 +184,23 b' class PasswordStore(object):' | |||
|
184 | 184 | |
|
185 | 185 | def clear_http_password(self, url, username): |
|
186 | 186 | """Drops saved password""" |
|
187 | self.set_http_password(url, username, "") | |
|
187 | self.set_http_password(url, username, b"") | |
|
188 | 188 | |
|
189 | 189 | @staticmethod |
|
190 | 190 | def _format_http_key(url, username): |
|
191 | 191 | """Construct actual key for password identification""" |
|
192 | return "%s@@%s" % (username, url) | |
|
192 | # keyring expects str, mercurial feeds as here mostly with bytes | |
|
193 | key = "%s@@%s" % (meu.pycompat.sysstr(username), | |
|
194 | meu.pycompat.sysstr(url)) | |
|
195 | return key | |
|
196 | ||
|
197 | @staticmethod | |
|
198 | def _format_smtp_key(machine, port, username): | |
|
199 | """Construct key for SMTP password identification""" | |
|
200 | key = "%s@@%s:%s" % (meu.pycompat.sysstr(username), | |
|
201 | meu.pycompat.sysstr(machine), | |
|
202 | str(port)) | |
|
203 | return key | |
|
193 | 204 | |
|
194 | 205 | def get_smtp_password(self, machine, port, username): |
|
195 | 206 | """Checks for SMTP password in keyring, returns |
@@ -208,11 +219,6 b' class PasswordStore(object):' | |||
|
208 | 219 | self.set_smtp_password(machine, port, username, "") |
|
209 | 220 | |
|
210 | 221 | @staticmethod |
|
211 | def _format_smtp_key(machine, port, username): | |
|
212 | """Construct key for SMTP password identification""" | |
|
213 | return "%s@@%s:%s" % (username, machine, str(port)) | |
|
214 | ||
|
215 | @staticmethod | |
|
216 | 222 | def _read_password_from_keyring(pwdkey): |
|
217 | 223 | """Physically read from keyring""" |
|
218 | 224 | keyring = import_keyring() |
@@ -220,9 +226,10 b' class PasswordStore(object):' | |||
|
220 | 226 | password = keyring.get_password(KEYRING_SERVICE, pwdkey) |
|
221 | 227 | except Exception as err: |
|
222 | 228 | ui = uimod.ui() |
|
223 | ui.warn(meu.ui_string("keyring: keyring backend doesn't seem to work, password can not be restored. Falling back to prompts. Error details: %s\n", | |
|
224 | err)) | |
|
225 |
|
|
|
229 | ui.warn(meu.ui_string( | |
|
230 | "keyring: keyring backend doesn't seem to work, password can not be restored. Falling back to prompts. Error details: %s\n", | |
|
231 | err)) | |
|
232 | return b'' | |
|
226 | 233 | # Reverse recoding from next routine |
|
227 | 234 | if isinstance(password, meu.pycompat.unicode): |
|
228 | 235 | return encoding.tolocal(password.encode('utf-8')) |
@@ -841,7 +848,7 b' def cmd_keyring_clear(ui, repo, path, **' | |||
|
841 | 848 | of path alias (``bitbucket``). |
|
842 | 849 | """ |
|
843 | 850 | path_url = path |
|
844 | for name, url in ui.configitems('paths'): | |
|
851 | for name, url in ui.configitems(b'paths'): | |
|
845 | 852 | if name == path: |
|
846 | 853 | path_url = url |
|
847 | 854 | break |
General Comments 0
You need to be logged in to leave comments.
Login now