diff mercurial/url.py @ 29379:fc777c855d66

largefiles: make cloning not ask two times about password (issue4883) Before this commit url.opener overwritten stored password for connection with given url/user even when new password for given connection was not filled. This commit makes opener overwrites saved authentication only when it contains password.
author liscju <piotr.listkiewicz@gmail.com>
date Thu, 09 Jun 2016 12:41:57 +0200
parents fea71f66ebff
children 0c741fd6158a
line wrap: on
line diff
--- a/mercurial/url.py	Thu Jun 09 11:41:36 2016 +0200
+++ b/mercurial/url.py	Thu Jun 09 12:41:57 2016 +0200
@@ -493,8 +493,10 @@
 
     passmgr = passwordmgr(ui, ui.httppasswordmgrdb)
     if authinfo is not None:
-        passmgr.add_password(*authinfo)
-        user, passwd = authinfo[2:4]
+        realm, uris, user, passwd = authinfo
+        saveduser, savedpass = passmgr.find_stored_password(uris[0])
+        if user != saveduser or passwd:
+            passmgr.add_password(realm, uris, user, passwd)
         ui.debug('http auth: user %s, password %s\n' %
                  (user, passwd and '*' * len(passwd) or 'not set'))