Mercurial > hg > hg-git
changeset 446:7e6fc0efc500
Removed support for URLs beginning with git@. These URLs are not possible from within mercurial.
author | Jason R. Coombs <jaraco@jaraco.com> |
---|---|
date | Fri, 27 Jan 2012 13:24:31 -0500 |
parents | cf3d83b60b59 |
children | 1189e52ba27c |
files | hggit/git_handler.py |
diffstat | 1 files changed, 17 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -1096,23 +1096,24 @@ if not issubclass(client.get_ssh_vendor, _ssh.SSHVendor): client.get_ssh_vendor = _ssh.generate_ssh_vendor(self.ui) - for handler, transport in (("git://", client.TCPGitClient), - ("git@", client.SSHGitClient), - ("git+ssh://", client.SSHGitClient)): - if uri.startswith(handler): - hostpath = uri[len(handler):] - # Support several URL forms, including separating the - # host and path with either a / or : (sepr) - pattern = re.compile( - '^(?P<host>.*?)(:(?P<port>\d+))?(?P<sepr>[:/])(?P<path>.*)$') - res = pattern.match(hostpath).groupdict() - host, port, sepr, path = res['host'], res['port'], res['sepr'], res['path'] - if sepr == '/': - path = '/' + path - if port: - client.port = port + # Test for git:// and git+ssh:// URI. + # Support several URL forms, including separating the + # host and path with either a / or : (sepr) + git_pattern = re.compile( + r'^(?P<scheme>git([+]ssh)?://)(?P<host>.*?)(:(?P<port>\d+))?' + r'(?P<sepr>[:/])(?P<path>.*)$' + ) + git_match = git_pattern.match(uri) + if git_match: + res = git_match.groupdict() + transport = client.SSHGitClient if 'ssh' in res['scheme'] else client.TCPGitClient + host, port, sepr, path = res['host'], res['port'], res['sepr'], res['path'] + if sepr == '/': + path = '/' + path + if port: + client.port = port - return transport(host, thin_packs=False, port=port), path + return transport(host, thin_packs=False, port=port), path httpclient = getattr(client, 'HttpGitClient', None)