[PATCH] largefiles: prevent excessive password prompt connecting to server (WIP)

Yuya Nishihara yuya at tcha.org
Fri May 27 23:33:05 EDT 2016


On Thu, 19 May 2016 18:42:11 +0200, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1463607605 -7200
> #      Wed May 18 23:40:05 2016 +0200
> # Node ID ae4392266c41d05391e11bac06136db0abb95016
> # Parent  90d84e1e427a9d65aedd870cdb7283f84bb30141
> largefiles: prevent excessive password prompt connecting to server (WIP)
> 
> This commit is just an idea of the solution to issue4883, its not
> production ready at all, im just looking forward to opinions about
> it.
> 
> The problem is largefiles creates own httppeer object to connect to the
> server, not reusing existing one created by commands from core. Every httppeer
> object has own password manager, so when user fills login information
> it is only visible to this one httppeer.
> 
> The idea of this commit is to make password manager singleton object so
> when mercurial extension creates own httppeer object for the same url and user
> it reuses remembered password in connection authentication.

I think a password manager should be held by ui if we need a storage per
session. But it would make a reference cycle. So, my idea is split passwordmgr
to a database and a ui wrapper, and make a database owned by ui.

  database = ui.httppasswordmgr()  # in-memory database that lives longer
  passwordmgr(ui, database)  # thin adapter that handles ui stuff

> +def passwordmgr(ui):
> +    global passwdmgr
> +    if passwdmgr is None:
> +        passwdmgr = _passwordmgr(ui)
> +    else:
> +        passwdmgr.ui = ui
> +    return passwdmgr

It would switch passwdmgr.ui held by active httppeer object if there are
more than one instances in process.


More information about the Mercurial-devel mailing list