Mercurial > hg > hg-git
changeset 870:6547d63aee4e
git_handler: reintroduce compatibility with dulwich 0.9.4 (issue124)
It's the version that ships with the latest Ubuntu LTS as of this writing.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Fri, 06 Mar 2015 10:58:33 -0800 |
parents | 875112f4bf0d |
children | 93689e8f27ac |
files | hggit/git_handler.py |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -1519,7 +1519,16 @@ opener = urllib2.build_opener(auth_handler) useragent = 'git/20x6 (hg-git ; uses dulwich and hg ; like git-core)' opener.addheaders = [('User-Agent', useragent)] - return client.HttpGitClient(uri, opener=opener), uri + try: + return client.HttpGitClient(uri, opener=opener), uri + except TypeError as e: + if e.message.find("unexpected keyword argument 'opener'") >= 0: + # Dulwich 0.9.4, which is the latest version that ships with + # Ubuntu 14.04, doesn't support the 'opener' keyword. Try + # without authentication. + return client.HttpGitClient(uri), uri + else: + raise # if its not git or git+ssh, try a local url.. return client.SubprocessGitClient(), uri