comparison hggit/git_handler.py @ 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
comparison
equal deleted inserted replaced
445:cf3d83b60b59 446:7e6fc0efc500
1094 def get_transport_and_path(self, uri): 1094 def get_transport_and_path(self, uri):
1095 # pass hg's ui.ssh config to dulwich 1095 # pass hg's ui.ssh config to dulwich
1096 if not issubclass(client.get_ssh_vendor, _ssh.SSHVendor): 1096 if not issubclass(client.get_ssh_vendor, _ssh.SSHVendor):
1097 client.get_ssh_vendor = _ssh.generate_ssh_vendor(self.ui) 1097 client.get_ssh_vendor = _ssh.generate_ssh_vendor(self.ui)
1098 1098
1099 for handler, transport in (("git://", client.TCPGitClient), 1099 # Test for git:// and git+ssh:// URI.
1100 ("git@", client.SSHGitClient), 1100 # Support several URL forms, including separating the
1101 ("git+ssh://", client.SSHGitClient)): 1101 # host and path with either a / or : (sepr)
1102 if uri.startswith(handler): 1102 git_pattern = re.compile(
1103 hostpath = uri[len(handler):] 1103 r'^(?P<scheme>git([+]ssh)?://)(?P<host>.*?)(:(?P<port>\d+))?'
1104 # Support several URL forms, including separating the 1104 r'(?P<sepr>[:/])(?P<path>.*)$'
1105 # host and path with either a / or : (sepr) 1105 )
1106 pattern = re.compile( 1106 git_match = git_pattern.match(uri)
1107 '^(?P<host>.*?)(:(?P<port>\d+))?(?P<sepr>[:/])(?P<path>.*)$') 1107 if git_match:
1108 res = pattern.match(hostpath).groupdict() 1108 res = git_match.groupdict()
1109 host, port, sepr, path = res['host'], res['port'], res['sepr'], res['path'] 1109 transport = client.SSHGitClient if 'ssh' in res['scheme'] else client.TCPGitClient
1110 if sepr == '/': 1110 host, port, sepr, path = res['host'], res['port'], res['sepr'], res['path']
1111 path = '/' + path 1111 if sepr == '/':
1112 if port: 1112 path = '/' + path
1113 client.port = port 1113 if port:
1114 1114 client.port = port
1115 return transport(host, thin_packs=False, port=port), path 1115
1116 return transport(host, thin_packs=False, port=port), path
1116 1117
1117 httpclient = getattr(client, 'HttpGitClient', None) 1118 httpclient = getattr(client, 'HttpGitClient', None)
1118 1119
1119 if uri.startswith('git+http://') or uri.startswith('git+https://'): 1120 if uri.startswith('git+http://') or uri.startswith('git+https://'):
1120 uri = uri[4:] 1121 uri = uri[4:]