Mercurial > hg > hg-git
diff hggit/git_handler.py @ 439:3f45c88100e8
add support for the HTTP smart protocol when using Dulwich tip
I have tested this with unauthenticated pulls from
Bitbucket. Authentication appears broken; I suspect this is a
limitation in Dulwich.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Wed, 05 Oct 2011 22:44:29 +0200 |
parents | ccd38138a3b3 |
children | 35e2813f58a5 |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -13,6 +13,11 @@ from mercurial import commands except ImportError: from hgext import bookmarks +try: + from mercurial.error import RepoError +except ImportError: + from mercurial.repo import RepoError + from mercurial.i18n import _ from mercurial.node import hex, bin, nullid from mercurial import context, util as hgutil @@ -1089,5 +1094,17 @@ transportpath = path return transport(host, thin_packs=False, port=port), transportpath + + httpclient = getattr(client, 'HttpGitClient', None) + + if uri.startswith('git+http://') or uri.startswith('git+https://'): + uri = uri[4:] + + if uri.startswith('http://') or uri.startswith('https://'): + if not httpclient: + raise RepoError('git via HTTP requires dulwich 0.8.1 or later') + else: + return client.HttpGitClient(uri, thin_packs=False), uri + # if its not git or git+ssh, try a local url.. return client.SubprocessGitClient(thin_packs=False), uri