From 97838c2daf8ffe114d05f28efa58fa2df21ebb64 Mon Sep 17 00:00:00 2001 From: Dov Feldstern Date: Thu, 13 Feb 2014 02:00:18 +0200 Subject: [PATCH] fallback to unauthenticated http(s) access when using older dulwich --- hggit/git_handler.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hggit/git_handler.py b/hggit/git_handler.py index a407469a3f..f654b206eb 100644 --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -1378,7 +1378,15 @@ class GitHandler(object): 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