Mercurial > jhg
diff src/org/tmatesoft/hg/internal/remote/SshConnector.java @ 698:822f3a83ff57
in, out and clone tests pass for ssh repositories. Infrastructure to decouple HgRemoteRepository from specific Connector implementation
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 06 Aug 2013 21:18:33 +0200 |
parents | 24f4efedc9d5 |
children | a483b2b68a2e |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/remote/SshConnector.java Tue Aug 06 13:34:34 2013 +0200 +++ b/src/org/tmatesoft/hg/internal/remote/SshConnector.java Tue Aug 06 21:18:33 2013 +0200 @@ -28,7 +28,7 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.io.SequenceInputStream; -import java.net.URL; +import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -54,7 +54,7 @@ */ public class SshConnector implements Connector { private SessionContext sessionCtx; - private URL url; + private URI uri; private Connection conn; private Session session; private int sessionUse; @@ -62,14 +62,14 @@ private StreamGobbler remoteErr, remoteOut; private OutputStream remoteIn; - public void init(URL url, SessionContext sessionContext, Object globalConfig) throws HgRuntimeException { + public void init(URI uri, SessionContext sessionContext, Object globalConfig) throws HgRuntimeException { sessionCtx = sessionContext; - this.url = url; + this.uri = uri; } public void connect() throws HgRemoteConnectionException, HgRuntimeException { try { - conn = new Connection(url.getHost(), url.getPort() == -1 ? 22 : url.getPort()); + conn = new Connection(uri.getHost(), uri.getPort() == -1 ? 22 : uri.getPort()); conn.connect(); } catch (IOException ex) { throw new HgRemoteConnectionException("Failed to establish connection"); @@ -101,7 +101,7 @@ } try { session = conn.openSession(); - final String path = url.getPath(); + final String path = uri.getPath(); session.execCommand(String.format("hg -R %s serve --stdio", path.charAt(0) == '/' ? path.substring(1) : path)); remoteErr = new StreamGobbler(session.getStderr()); remoteOut = new StreamGobbler(session.getStdout()); @@ -123,7 +123,7 @@ } public String getServerLocation() { - return url.toString(); // FIXME + return uri.toString(); // FIXME } public String getCapabilities() throws HgRemoteConnectionException {