# HG changeset patch # User Marcin Kasperski # Date 2015-11-12 23:50:58 # Node ID 44833bd3c29c5d6b891ee605b5f0e27a4cb7d04c # Parent 3331d6852d3da6e15ca1d54b5a17ab60d3f290fb keyring_check handles a few args diff --git a/mercurial_keyring.py b/mercurial_keyring.py --- a/mercurial_keyring.py +++ b/mercurial_keyring.py @@ -677,7 +677,7 @@ def _smtp(ui): # Custom commands ############################################################ -def cmd_keyring_check(ui, repo, path=None, **opts): +def cmd_keyring_check(ui, repo, *path_args, **opts): """ Prints basic info (whether password is currently saved, and how is it identified) for given path or all defined repo paths. @@ -687,26 +687,25 @@ def cmd_keyring_check(ui, repo, path=Non re_http_url = re.compile(r'^https?://') defined_paths = [(name, url) for name, url in ui.configitems('paths')] - if path: + if path_args: # Maybe parameter is an alias defined_paths_dic = dict(defined_paths) - resolved = defined_paths_dic.get(path, path) - if not re_http_url.search(resolved): - ui.status(_("keyring: %s is not http path (%s)\n") % (path, resolved)) - return - paths = [(path, resolved)] + paths = [(path_arg, defined_paths_dic.get(path_arg, path_arg)) + for path_arg in path_args] else: - paths = [(name, url) for name, url in defined_paths - if re_http_url.search(url)] + paths = [(name, url) for name, url in defined_paths] if not paths: - ui.status(_("keyring: no http path aliases defined\n")) - return + ui.status(_("keyring_check: no paths defined")) handler = HTTPPasswordHandler() ui.status(_("keyring password save status:\n")) for name, url in paths: + if not re_http_url.search(url): + if path_args: + ui.status(_(" %s: non-http path (%s)\n") % (name, url)) + continue user, pwd, source, final_url = handler.get_credentials(passwordmgr(ui), name, url) if pwd: ui.status(_(" %s: password available, source: %s, bound to user %s, url %s\n") % (