mercurial/httprepo.py
changeset 2556 f1ebc4311f47
parent 2501 b73552a00b20
child 2557 1727ff712a4e
--- 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(