https+auth: use a ~/.git-credentials file if it exists to fetch credentials In some situations we code the plain auth-less uri in the hgrc paths section (for convenience) and want to use a centrally-stored credentials file. Though it is possible to use the hgrc [auth] section, it would be also nice to access .git-credentials (still usefull for git direct access), avoiding double maintenance of credentials. This probably does not cover all possible situations with git credentials handling (a vast topic) but it provides a working base. closes 305
1 files changed, 9 insertions(+), 0 deletions(-) M hggit/git_handler.py
M hggit/git_handler.py +9 -0
@@ 1742,6 1742,15 @@ class GitHandler(object): username = username.decode('latin-1') if password is not None: password = password.decode('latin-1') + if url.user is None: + username_password = client.get_credentials_from_store( + url.scheme, + url.host + ) + if username_password is not None: + username, password = username_password + username = username.decode('utf-8') + password = password.decode('utf-8') return ( client.HttpGitClient( str_uri,