diff mercurial/url.py @ 20291:7d589d923b8a

url: added authuri when login information is requested (issue3209) When users are using a revset they can get multiple password prompts. This prompts have no extra information about which password is being requested so I added the authuri to the prompt to make it recognizable. As in: $ hg log -r "outgoing('https://bitbucket.org/mg/test') - outgoing('https://bitbucket.org/nesneros/test')" http authorization required realm: Bitbucket.org HTTP user: interrupted! I changed it to describe the url when prompting for password. As in: $ hg log -r "outgoing('https://bitbucket.org/mg/test') - outgoing('https://bitbucket.org/nesneros/test')" http authorization required for https://bitbucket.org/mg/test realm: Bitbucket.org HTTP user: interrupted!
author Lucas Moscovicz <lmoscovicz@fb.com>
date Wed, 15 Jan 2014 16:46:20 -0800
parents af02783dea65
children a939eeb94833
line wrap: on
line diff
--- a/mercurial/url.py	Fri Jan 17 23:55:11 2014 +0900
+++ b/mercurial/url.py	Wed Jan 15 16:46:20 2014 -0800
@@ -32,10 +32,14 @@
                 user, passwd = auth.get('username'), auth.get('password')
                 self.ui.debug("using auth.%s.* for authentication\n" % group)
         if not user or not passwd:
+            u = util.url(authuri)
+            u.query = None
             if not self.ui.interactive():
-                raise util.Abort(_('http authorization required'))
+                raise util.Abort(_('http authorization required for %s') %
+                                 util.hidepassword(str(u)))
 
-            self.ui.write(_("http authorization required\n"))
+            self.ui.write(_("http authorization required for %s\n") %
+                          util.hidepassword(str(u)))
             self.ui.write(_("realm: %s\n") % realm)
             if user:
                 self.ui.write(_("user: %s\n") % user)