##// END OF EJS Templates
keyring_check handles a few args
Marcin Kasperski -
r188:44833bd3 default
parent child Browse files
Show More
@@ -677,7 +677,7 b' def _smtp(ui):'
677 # Custom commands
677 # Custom commands
678 ############################################################
678 ############################################################
679
679
680 def cmd_keyring_check(ui, repo, path=None, **opts):
680 def cmd_keyring_check(ui, repo, *path_args, **opts):
681 """
681 """
682 Prints basic info (whether password is currently saved, and how is
682 Prints basic info (whether password is currently saved, and how is
683 it identified) for given path or all defined repo paths.
683 it identified) for given path or all defined repo paths.
@@ -687,26 +687,25 b' def cmd_keyring_check(ui, repo, path=Non'
687 re_http_url = re.compile(r'^https?://')
687 re_http_url = re.compile(r'^https?://')
688 defined_paths = [(name, url)
688 defined_paths = [(name, url)
689 for name, url in ui.configitems('paths')]
689 for name, url in ui.configitems('paths')]
690 if path:
690 if path_args:
691 # Maybe parameter is an alias
691 # Maybe parameter is an alias
692 defined_paths_dic = dict(defined_paths)
692 defined_paths_dic = dict(defined_paths)
693 resolved = defined_paths_dic.get(path, path)
693 paths = [(path_arg, defined_paths_dic.get(path_arg, path_arg))
694 if not re_http_url.search(resolved):
694 for path_arg in path_args]
695 ui.status(_("keyring: %s is not http path (%s)\n") % (path, resolved))
696 return
697 paths = [(path, resolved)]
698 else:
695 else:
699 paths = [(name, url) for name, url in defined_paths
696 paths = [(name, url) for name, url in defined_paths]
700 if re_http_url.search(url)]
701
697
702 if not paths:
698 if not paths:
703 ui.status(_("keyring: no http path aliases defined\n"))
699 ui.status(_("keyring_check: no paths defined"))
704 return
705
700
706 handler = HTTPPasswordHandler()
701 handler = HTTPPasswordHandler()
707
702
708 ui.status(_("keyring password save status:\n"))
703 ui.status(_("keyring password save status:\n"))
709 for name, url in paths:
704 for name, url in paths:
705 if not re_http_url.search(url):
706 if path_args:
707 ui.status(_(" %s: non-http path (%s)\n") % (name, url))
708 continue
710 user, pwd, source, final_url = handler.get_credentials(passwordmgr(ui), name, url)
709 user, pwd, source, final_url = handler.get_credentials(passwordmgr(ui), name, url)
711 if pwd:
710 if pwd:
712 ui.status(_(" %s: password available, source: %s, bound to user %s, url %s\n") % (
711 ui.status(_(" %s: password available, source: %s, bound to user %s, url %s\n") % (
General Comments 0
You need to be logged in to leave comments. Login now