2
0
Эх сурвалжийг харах

Support the ssh: URL scheme.

Jelmer Vernooij 9 жил өмнө
parent
commit
9e5d92fe43

+ 5 - 0
NEWS

@@ -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

+ 1 - 1
dulwich/client.py

@@ -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:]

+ 9 - 1
dulwich/tests/test_client.py

@@ -310,7 +310,7 @@ class TestGetTransportAndPath(TestCase):
         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)
@@ -318,6 +318,14 @@ class TestGetTransportAndPath(TestCase):
         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')