Skip to content

Commit

Permalink
Support the ssh: URL scheme.
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer committed Jan 4, 2016
1 parent 4cc972c commit 9e5d92f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
0.12.1 UNRELEASED

IMPROVEMENTS

* Support `ssh://` URLs in get_transport_and_path_from_url().
(Jelmer Vernooij, #402)

0.12.0 2015-12-13

IMPROVEMENTS
Expand Down
2 changes: 1 addition & 1 deletion dulwich/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ def get_transport_and_path_from_url(url, config=None, **kwargs):
if parsed.scheme == 'git':
return (TCPGitClient(parsed.hostname, port=parsed.port, **kwargs),
parsed.path)
elif parsed.scheme == 'git+ssh':
elif parsed.scheme in ('git+ssh', 'ssh'):
path = parsed.path
if path.startswith('/'):
path = parsed.path[1:]
Expand Down
10 changes: 9 additions & 1 deletion dulwich/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,22 @@ def test_tcp_port(self):
self.assertEqual(1234, c._port)
self.assertEqual('/bar/baz', path)

def test_ssh_explicit(self):
def test_git_ssh_explicit(self):
c, path = get_transport_and_path('git+ssh://foo.com/bar/baz')
self.assertTrue(isinstance(c, SSHGitClient))
self.assertEqual('foo.com', c.host)
self.assertEqual(None, c.port)
self.assertEqual(None, c.username)
self.assertEqual('bar/baz', path)

def test_ssh_explicit(self):
c, path = get_transport_and_path('ssh://foo.com/bar/baz')
self.assertTrue(isinstance(c, SSHGitClient))
self.assertEqual('foo.com', c.host)
self.assertEqual(None, c.port)
self.assertEqual(None, c.username)
self.assertEqual('bar/baz', path)

def test_ssh_port_explicit(self):
c, path = get_transport_and_path(
'git+ssh://foo.com:1234/bar/baz')
Expand Down

0 comments on commit 9e5d92f

Please sign in to comment.