Mercurial > hg-stable
changeset 2556:f1ebc4311f47
Allow http://user@example.com URLs (i.e. without passwords)
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 03 Jul 2006 00:23:56 -0300 |
parents | d6605381c6df |
children | 1727ff712a4e |
files | mercurial/httprepo.py |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/httprepo.py Sun Jul 02 22:39:39 2006 -0300 +++ b/mercurial/httprepo.py Mon Jul 03 00:23:56 2006 -0300 @@ -20,16 +20,22 @@ def find_user_password(self, realm, authuri): authinfo = urllib2.HTTPPasswordMgrWithDefaultRealm.find_user_password( self, realm, authuri) - if authinfo != (None, None): - return authinfo + user, passwd = authinfo + if user and passwd: + return (user, passwd) if not self.ui.interactive: raise util.Abort(_('http authorization required')) self.ui.write(_("http authorization required\n")) self.ui.status(_("realm: %s\n") % realm) - user = self.ui.prompt(_("user:"), default=None) - passwd = self.ui.getpass() + if user: + self.ui.status(_("user: %s\n") % user) + else: + user = self.ui.prompt(_("user:"), default=None) + + if not passwd: + passwd = self.ui.getpass() self.add_password(realm, authuri, user, passwd) return (user, passwd) @@ -148,8 +154,8 @@ passmgr = passwordmgr(ui) if user: - ui.debug(_('will use user %s, password %s for http auth\n') % - (user, '*' * len(passwd))) + ui.debug(_('http auth: user %s, password %s\n') % + (user, passwd and '*' * len(passwd) or 'not set')) passmgr.add_password(None, host, user, passwd or '') opener = urllib2.build_opener(