mercurial/url.py
changeset 29379 fc777c855d66
parent 29378 fea71f66ebff
child 29455 0c741fd6158a
--- 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'))