diff --git a/mercurial_keyring.py b/mercurial_keyring.py --- a/mercurial_keyring.py +++ b/mercurial_keyring.py @@ -120,7 +120,7 @@ class HTTPPasswordHandler(object): # Loading .hg/hgrc [auth] section contents. If prefix is given, # it will be used as a key to lookup password in the keyring. - auth_user, pwd, prefix_url = self.load_hgrc_auth(ui, base_url) + auth_user, pwd, prefix_url = self.load_hgrc_auth(ui, base_url, user) if prefix_url: keyring_url = prefix_url else: @@ -197,7 +197,7 @@ class HTTPPasswordHandler(object): self.last_reply = dict(realm=realm,authuri=authuri,user=user) return user, pwd - def load_hgrc_auth(self, ui, base_url): + def load_hgrc_auth(self, ui, base_url, user): """ Loading [auth] section contents from local .hgrc @@ -241,7 +241,11 @@ class HTTPPasswordHandler(object): # hg 1.9 import mercurial.httpconnection readauthforuri = mercurial.httpconnection.readauthforuri - res = readauthforuri(local_ui, base_url) + if readauthforuri.func_code.co_argcount == 3: + # Since hg.0593e8f81c71 + res = readauthforuri(local_ui, base_url, user) + else: + res = readauthforuri(local_ui, base_url) if res: group, auth_token = res else: