[PATCH 3 of 3] largefiles: makes cloning not ask two times about password (issue4883)

Yuya Nishihara yuya at tcha.org
Sat Jun 18 09:54:37 EDT 2016


On Tue, 14 Jun 2016 11:13:31 +0200, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1465468917 -7200
> #      Thu Jun 09 12:41:57 2016 +0200
> # Node ID dd39cbc25d53a403f74fb545bab64fe64a47a21f
> # Parent  62fac77f1cd9e4270b2db7a7a987bc12783b41a8
> largefiles: makes 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.
> 
> diff --git a/mercurial/url.py b/mercurial/url.py
> --- a/mercurial/url.py
> +++ b/mercurial/url.py
> @@ -493,8 +493,11 @@ def opener(ui, authinfo=None):
>  
>      passmgr = passwordmgr(ui, ui.httppasswordmgrdb)
>      if authinfo is not None:
> -        passmgr.add_password(*authinfo)
>          user, passwd = authinfo[2:4]
> +        saveduser, savedpass = passmgr.find_stored_password(
> +            authinfo[1][0])
> +        if user != saveduser or passwd:
> +            passmgr.add_password(*authinfo)

Perhaps it's better to destructure all elements of authinfo tuple. It isn't
easy to understand what the authinfo[1] is.


More information about the Mercurial-devel mailing list