Mercurial > hg-git
diff hggit/git_handler.py @ 261:29e5072ddaab
Handle normal relative SSH paths (i.e for heroku and gitosis) as well as github style paths.
author | Lincoln Stoll <lstoll@lstoll.net> |
---|---|
date | Mon, 19 Oct 2009 17:48:07 +0200 |
parents | 6977263c4d80 |
children | 5347d8c94021 c2d6b1093e7e |
line wrap: on
line diff
--- a/hggit/git_handler.py Sun Oct 25 10:55:12 2009 -0500 +++ b/hggit/git_handler.py Mon Oct 19 17:48:07 2009 +0200 @@ -839,7 +839,24 @@ from dulwich.client import TCPGitClient, SSHGitClient, SubprocessGitClient for handler, transport in (("git://", TCPGitClient), ("git@", SSHGitClient), ("git+ssh://", SSHGitClient)): if uri.startswith(handler): - host, path = uri[len(handler):].split("/", 1) - return transport(host, thin_packs=False), '/' + path + # We need to split around : or /, whatever comes first + hostpath = uri[len(handler):] + if (hostpath.find(':') > 0 and hostpath.find('/') > 0): + # we have both, whatever is first wins. + if hostpath.find(':') < hostpath.find('/'): + hostpath_seper = ':' + else: + hostpath_seper = '/' + elif hostpath.find(':') > 0: + hostpath_seper = ':' + else: + hostpath_seper = '/' + + host, path = hostpath.split(hostpath_seper, 1) + if hostpath_seper == '/': + transportpath = '/' + path + else: + transportpath = path + return transport(host, thin_packs=False), transportpath # if its not git or git+ssh, try a local url.. return SubprocessGitClient(thin_packs=False), uri