Mercurial > hg-git
diff hggit/git_handler.py @ 635:f933e3930f78
fallback to unauthenticated http(s) access when using older dulwich
author | Dov Feldstern <dfeldstern@gmail.com> |
---|---|
date | Thu, 13 Feb 2014 02:00:18 +0200 |
parents | ca7fc2d23a21 |
children | 42ca3ace9a0f |
line wrap: on
line diff
--- a/hggit/git_handler.py Thu Feb 13 01:37:22 2014 +0200 +++ b/hggit/git_handler.py Thu Feb 13 02:00:18 2014 +0200 @@ -1378,7 +1378,15 @@ else: auth_handler = urllib2.HTTPBasicAuthHandler(AuthManager(self.ui)) opener = urllib2.build_opener(auth_handler) - return client.HttpGitClient(uri, opener=opener, thin_packs=False), uri + try: + return client.HttpGitClient(uri, opener=opener, thin_packs=False), uri + except TypeError as e: + if e.message.find("unexpected keyword argument 'opener'") >= 0: + # using a version of dulwich that doesn't support + # http(s) authentication -- try without authentication + return client.HttpGitClient(uri, thin_packs=False), uri + else: + raise # if its not git or git+ssh, try a local url.. return client.SubprocessGitClient(thin_packs=False), uri