##// END OF EJS Templates
keyring_check and keyring_clear can be run outside repository...
Marcin Kasperski -
r217:1efb4fd4 default
parent child Browse files
Show More
@@ -702,11 +702,15 b' command = meu.command(cmdtable)'
702
702
703 @command('keyring_check',
703 @command('keyring_check',
704 [],
704 [],
705 _("keyring_check [PATH]"))
705 _("keyring_check [PATH]"),
706 optionalrepo=True)
706 def cmd_keyring_check(ui, repo, *path_args, **opts): # pylint: disable=unused-argument
707 def cmd_keyring_check(ui, repo, *path_args, **opts): # pylint: disable=unused-argument
707 """
708 """
708 Prints basic info (whether password is currently saved, and how is
709 Prints basic info (whether password is currently saved, and how is
709 it identified) for given path or for all defined repo paths which are HTTP.
710 it identified) for given path.
711
712 Can be run without parameters to show status for all (current repository) paths which
713 are HTTP-like.
710 """
714 """
711 defined_paths = [(name, url)
715 defined_paths = [(name, url)
712 for name, url in ui.configitems('paths')]
716 for name, url in ui.configitems('paths')]
@@ -716,10 +720,14 b' def cmd_keyring_check(ui, repo, *path_ar'
716 paths = [(path_arg, defined_paths_dic.get(path_arg, path_arg))
720 paths = [(path_arg, defined_paths_dic.get(path_arg, path_arg))
717 for path_arg in path_args]
721 for path_arg in path_args]
718 else:
722 else:
723 if not repo:
724 ui.status(_("Url to check not specified. Either run ``hg keyring_check https://...``, or run the command inside some repository (to test all defined paths).\n"))
725 return
719 paths = [(name, url) for name, url in defined_paths]
726 paths = [(name, url) for name, url in defined_paths]
720
727
721 if not paths:
728 if not paths:
722 ui.status(_("keyring_check: no paths defined\n"))
729 ui.status(_("keyring_check: no paths defined\n"))
730 return
723
731
724 handler = HTTPPasswordHandler()
732 handler = HTTPPasswordHandler()
725
733
@@ -744,10 +752,14 b' def cmd_keyring_check(ui, repo, *path_ar'
744
752
745 @command('keyring_clear',
753 @command('keyring_clear',
746 [],
754 [],
747 _('hg keyring_clear PATH'))
755 _('hg keyring_clear PATH-OR-ALIAS'),
756 optionalrepo=True)
748 def cmd_keyring_clear(ui, repo, path, **opts): # pylint: disable=unused-argument
757 def cmd_keyring_clear(ui, repo, path, **opts): # pylint: disable=unused-argument
749 """
758 """
750 Drops password bound to given path (if any is saved).
759 Drops password bound to given path (if any is saved).
760
761 Parameter can be given as full url (``https://John@bitbucket.org``) or as the name
762 of path alias (``bitbucket``).
751 """
763 """
752 path_url = path
764 path_url = path
753 for name, url in ui.configitems('paths'):
765 for name, url in ui.configitems('paths'):
@@ -755,7 +767,7 b' def cmd_keyring_clear(ui, repo, path, **'
755 path_url = url
767 path_url = url
756 break
768 break
757 if not is_http_path(path_url):
769 if not is_http_path(path_url):
758 ui.warn(_("%s is not a http path (%s)") % (path, path_url))
770 ui.status(_("%s is not a http path (and %s can't be resolved as path alias)\n") % (path, path_url))
759 return
771 return
760
772
761 handler = HTTPPasswordHandler()
773 handler = HTTPPasswordHandler()
General Comments 0
You need to be logged in to leave comments. Login now