##// END OF EJS Templates
Allow http://user@example.com URLs (i.e. without passwords)
Alexis S. L. Carvalho -
r2556:f1ebc431 default
parent child Browse files
Show More
@@ -20,16 +20,22 b' class passwordmgr(urllib2.HTTPPasswordMg'
20 20 def find_user_password(self, realm, authuri):
21 21 authinfo = urllib2.HTTPPasswordMgrWithDefaultRealm.find_user_password(
22 22 self, realm, authuri)
23 if authinfo != (None, None):
24 return authinfo
23 user, passwd = authinfo
24 if user and passwd:
25 return (user, passwd)
25 26
26 27 if not self.ui.interactive:
27 28 raise util.Abort(_('http authorization required'))
28 29
29 30 self.ui.write(_("http authorization required\n"))
30 31 self.ui.status(_("realm: %s\n") % realm)
31 user = self.ui.prompt(_("user:"), default=None)
32 passwd = self.ui.getpass()
32 if user:
33 self.ui.status(_("user: %s\n") % user)
34 else:
35 user = self.ui.prompt(_("user:"), default=None)
36
37 if not passwd:
38 passwd = self.ui.getpass()
33 39
34 40 self.add_password(realm, authuri, user, passwd)
35 41 return (user, passwd)
@@ -148,8 +154,8 b' class httprepository(remoterepository):'
148 154
149 155 passmgr = passwordmgr(ui)
150 156 if user:
151 ui.debug(_('will use user %s, password %s for http auth\n') %
152 (user, '*' * len(passwd)))
157 ui.debug(_('http auth: user %s, password %s\n') %
158 (user, passwd and '*' * len(passwd) or 'not set'))
153 159 passmgr.add_password(None, host, user, passwd or '')
154 160
155 161 opener = urllib2.build_opener(
General Comments 0
You need to be logged in to leave comments. Login now