##// END OF EJS Templates
Reverting ui. change, it doesn't work after all (but uniformizing the way status entries are written)
Marcin Kasperski -
r270:64b6b48a default
parent child Browse files
Show More
@@ -220,7 +220,7 b' class PasswordStore(object):'
220 password = keyring.get_password(KEYRING_SERVICE, pwdkey)
220 password = keyring.get_password(KEYRING_SERVICE, pwdkey)
221 except Exception as err:
221 except Exception as err:
222 ui = uimod.ui()
222 ui = uimod.ui()
223 ui.warn(_("keyring: keyring backend doesn't seem to work, password can not be restored. Falling back to prompts. Error details: %s\n"),
223 ui.warn(_("keyring: keyring backend doesn't seem to work, password can not be restored. Falling back to prompts. Error details: %s\n") %
224 err)
224 err)
225 return ''
225 return ''
226 # Reverse recoding from next routine
226 # Reverse recoding from next routine
@@ -240,7 +240,7 b' class PasswordStore(object):'
240 KEYRING_SERVICE, pwdkey, password)
240 KEYRING_SERVICE, pwdkey, password)
241 except Exception as err:
241 except Exception as err:
242 ui = uimod.ui()
242 ui = uimod.ui()
243 ui.warn(_("keyring: keyring backend doesn't seem to work, password was not saved. Error details: %s\n"),
243 ui.warn(_("keyring: keyring backend doesn't seem to work, password was not saved. Error details: %s\n") %
244 err)
244 err)
245
245
246
246
@@ -329,8 +329,8 b' class HTTPPasswordHandler(object):'
329
329
330 parsed_url, url_user, url_passwd = self.unpack_url(authuri)
330 parsed_url, url_user, url_passwd = self.unpack_url(authuri)
331 base_url = str(parsed_url)
331 base_url = str(parsed_url)
332 ui.debug(_('keyring: base url: %s, url user: %s, url pwd: %s\n'),
332 ui.debug(_('keyring: base url: %s, url user: %s, url pwd: %s\n') %
333 base_url, url_user or '', url_passwd and '******' or '')
333 (base_url, url_user or '', url_passwd and '******' or ''))
334
334
335 # Extract username (or password) stored directly in url
335 # Extract username (or password) stored directly in url
336 if url_user and url_passwd:
336 if url_user and url_passwd:
@@ -371,8 +371,8 b' class HTTPPasswordHandler(object):'
371
371
372 # Load from keyring.
372 # Load from keyring.
373 if actual_user:
373 if actual_user:
374 ui.debug(_("keyring: looking for password (user %s, url %s)\n"),
374 ui.debug(_("keyring: looking for password (user %s, url %s)\n") %
375 actual_user, keyring_url)
375 (actual_user, keyring_url))
376 keyring_pwd = password_store.get_http_password(keyring_url, actual_user)
376 keyring_pwd = password_store.get_http_password(keyring_url, actual_user)
377 if keyring_pwd:
377 if keyring_pwd:
378 return actual_user, keyring_pwd, self.SRC_KEYRING, keyring_url
378 return actual_user, keyring_pwd, self.SRC_KEYRING, keyring_url
@@ -389,8 +389,8 b' class HTTPPasswordHandler(object):'
389 ui.status(_("keyring: username not specified in hgrc (or in url). Password will not be saved.\n"))
389 ui.status(_("keyring: username not specified in hgrc (or in url). Password will not be saved.\n"))
390
390
391 ui.write(_("http authorization required\n"))
391 ui.write(_("http authorization required\n"))
392 ui.status(_("realm: %s\n"), realm)
392 ui.status(_("realm: %s\n") % realm)
393 ui.status(_("url: %s\n"), url)
393 ui.status(_("url: %s\n") % url)
394 if user:
394 if user:
395 ui.write(_("user: %s (fixed in hgrc or url)\n", user))
395 ui.write(_("user: %s (fixed in hgrc or url)\n", user))
396 else:
396 else:
@@ -625,13 +625,13 b' def try_smtp_login(ui, smtp_obj, usernam'
625 if not password:
625 if not password:
626 return False
626 return False
627 try:
627 try:
628 ui.note(_('(authenticating to mail server as %s)\n'),
628 ui.note(_('(authenticating to mail server as %s)\n') %
629 username)
629 username)
630 smtp_obj.login(username, password)
630 smtp_obj.login(username, password)
631 return True
631 return True
632 except smtplib.SMTPException as inst:
632 except smtplib.SMTPException as inst:
633 if inst.smtp_code == 535:
633 if inst.smtp_code == 535:
634 ui.status(_("SMTP login failed: %s\n\n"),
634 ui.status(_("SMTP login failed: %s\n\n") %
635 inst.smtp_error)
635 inst.smtp_error)
636 return False
636 return False
637 else:
637 else:
@@ -694,8 +694,8 b' def keyring_supported_smtp(ui, username)'
694 else:
694 else:
695 defaultport = 25
695 defaultport = 25
696 mailport = util.getport(ui.config('smtp', 'port', defaultport))
696 mailport = util.getport(ui.config('smtp', 'port', defaultport))
697 ui.note(_('sending mail: smtp host %s, port %s\n'),
697 ui.note(_('sending mail: smtp host %s, port %s\n') %
698 mailhost, mailport)
698 (mailhost, mailport))
699 s.connect(host=mailhost, port=mailport)
699 s.connect(host=mailhost, port=mailport)
700 if starttls:
700 if starttls:
701 ui.note(_('(using starttls)\n'))
701 ui.note(_('(using starttls)\n'))
@@ -797,20 +797,20 b' def cmd_keyring_check(ui, repo, *path_ar'
797 for name, url in paths:
797 for name, url in paths:
798 if not is_http_path(url):
798 if not is_http_path(url):
799 if path_args:
799 if path_args:
800 ui.status(_(" %s: non-http path (%s)\n"),
800 ui.status(_(" %s: non-http path (%s)\n") %
801 name, url)
801 (name, url))
802 continue
802 continue
803 user, pwd, source, final_url = handler.get_credentials(
803 user, pwd, source, final_url = handler.get_credentials(
804 make_passwordmgr(ui), name, url)
804 make_passwordmgr(ui), name, url)
805 if pwd:
805 if pwd:
806 ui.status(_(" %s: password available, source: %s, bound to user %s, url %s\n"),
806 ui.status(_(" %s: password available, source: %s, bound to user %s, url %s\n") %
807 name, source, user, final_url)
807 (name, source, user, final_url))
808 elif user:
808 elif user:
809 ui.status(_(" %s: password not available, once entered, will be bound to user %s, url %s\n"),
809 ui.status(_(" %s: password not available, once entered, will be bound to user %s, url %s\n") %
810 name, user, final_url)
810 (name, user, final_url))
811 else:
811 else:
812 ui.status(_(" %s: password not available, user unknown, url %s\n"),
812 ui.status(_(" %s: password not available, user unknown, url %s\n") %
813 name, final_url)
813 (name, final_url))
814
814
815
815
816 @command(b'keyring_clear',
816 @command(b'keyring_clear',
@@ -830,8 +830,8 b' def cmd_keyring_clear(ui, repo, path, **'
830 path_url = url
830 path_url = url
831 break
831 break
832 if not is_http_path(path_url):
832 if not is_http_path(path_url):
833 ui.status(_("%s is not a http path (and %s can't be resolved as path alias)\n"),
833 ui.status(_("%s is not a http path (and %s can't be resolved as path alias)\n") %
834 path, path_url)
834 (path, path_url))
835 return
835 return
836
836
837 handler = HTTPPasswordHandler()
837 handler = HTTPPasswordHandler()
@@ -839,21 +839,21 b' def cmd_keyring_clear(ui, repo, path, **'
839 user, pwd, source, final_url = handler.get_credentials(
839 user, pwd, source, final_url = handler.get_credentials(
840 make_passwordmgr(ui), path, path_url)
840 make_passwordmgr(ui), path, path_url)
841 if not user:
841 if not user:
842 ui.status(_("Username not configured for url %s\n"),
842 ui.status(_("Username not configured for url %s\n") %
843 final_url)
843 final_url)
844 return
844 return
845 if not pwd:
845 if not pwd:
846 ui.status(_("No password is saved for user %s, url %s\n"),
846 ui.status(_("No password is saved for user %s, url %s\n") %
847 user, final_url)
847 (user, final_url))
848 return
848 return
849
849
850 if source != handler.SRC_KEYRING:
850 if source != handler.SRC_KEYRING:
851 ui.status(_("Password for user %s, url %s is saved in %s, not in keyring\n"),
851 ui.status(_("Password for user %s, url %s is saved in %s, not in keyring\n") %
852 user, final_url, source)
852 (user, final_url, source))
853
853
854 password_store.clear_http_password(final_url, user)
854 password_store.clear_http_password(final_url, user)
855 ui.status(_("Password removed for user %s, url %s\n"),
855 ui.status(_("Password removed for user %s, url %s\n") %
856 user, final_url)
856 (user, final_url))
857
857
858
858
859 buglink = 'https://bitbucket.org/Mekk/mercurial_keyring/issues'
859 buglink = 'https://bitbucket.org/Mekk/mercurial_keyring/issues'
General Comments 0
You need to be logged in to leave comments. Login now