diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2021-09-12 23:35:33 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2021-09-29 17:13:05 +0200 |
commit | 9683bc71b6c05ce1ca2b5d6c6f7d74fff3db8429 (patch) | |
tree | 651bbef8070a2094d5fe1e1e297e44f58d81a361 | |
parent | 68a638deb09a4f0dbc0bddce9ef233ed682c1767 (diff) | |
download | jgit-9683bc71b6c05ce1ca2b5d6c6f7d74fff3db8429.tar.gz jgit-9683bc71b6c05ce1ca2b5d6c6f7d74fff3db8429.zip |
Fix split package in bundle org.eclipse.jgit.ssh.jsch
The package org.eclipse.jgit.transport was split between
org.eclipse.jgit and org.eclipse.jgit.ssh.jsch.
Bug: 564544
Change-Id: I91d38e67c65ed97a880f8dc8f9559663b9eec33b
15 files changed, 84 insertions, 38 deletions
diff --git a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF index 67d1d51720..89ad6d1f3c 100644 --- a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF @@ -43,6 +43,7 @@ Import-Package: javax.servlet;version="[3.1.0,4.0.0)", org.eclipse.jgit.transport;version="[6.0.0,6.1.0)", org.eclipse.jgit.transport.http.apache;version="[6.0.0,6.1.0)", org.eclipse.jgit.transport.resolver;version="[6.0.0,6.1.0)", + org.eclipse.jgit.transport.ssh.jsch;version="[6.0.0,6.1.0)", org.eclipse.jgit.transport.sshd;version="[6.0.0,6.1.0)", org.eclipse.jgit.treewalk;version="[6.0.0,6.1.0)", org.eclipse.jgit.treewalk.filter;version="[6.0.0,6.1.0)", diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java index 600200d71d..6cfe93d850 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java @@ -36,8 +36,8 @@ import org.eclipse.jgit.pgm.internal.CLIText; import org.eclipse.jgit.pgm.internal.SshDriver; import org.eclipse.jgit.pgm.opt.CmdLineParser; import org.eclipse.jgit.revwalk.RevWalk; -import org.eclipse.jgit.transport.JschConfigSessionFactory; import org.eclipse.jgit.transport.SshSessionFactory; +import org.eclipse.jgit.transport.ssh.jsch.JschConfigSessionFactory; import org.eclipse.jgit.transport.sshd.DefaultProxyDataFactory; import org.eclipse.jgit.transport.sshd.JGitKeyCache; import org.eclipse.jgit.transport.sshd.SshdSessionFactory; diff --git a/org.eclipse.jgit.ssh.jsch.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.ssh.jsch.test/META-INF/MANIFEST.MF index 693f192e24..a155ccf020 100644 --- a/org.eclipse.jgit.ssh.jsch.test/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.ssh.jsch.test/META-INF/MANIFEST.MF @@ -13,6 +13,7 @@ Import-Package: com.jcraft.jsch;version="[0.1.54,0.2.0)", org.eclipse.jgit.junit.ssh;version="[6.0.0,6.1.0)", org.eclipse.jgit.lib;version="[6.0.0,6.1.0)", org.eclipse.jgit.transport;version="[6.0.0,6.1.0)", + org.eclipse.jgit.transport.ssh.jsch;version="[6.0.0,6.1.0)", org.eclipse.jgit.util;version="[6.0.0,6.1.0)", org.hamcrest;version="[1.1.0,3.0.0)", org.junit;version="[4.13,5.0.0)", diff --git a/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/JSchSshProtocol2Test.java b/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/JSchSshProtocol2Test.java index 0929c55c07..611d4e8bcb 100644 --- a/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/JSchSshProtocol2Test.java +++ b/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/JSchSshProtocol2Test.java @@ -9,7 +9,7 @@ */ //TODO(ms): move to org.eclipse.jgit.ssh.jsch in 6.0 -package org.eclipse.jgit.transport; +package org.eclipse.jgit.transport.ssh.jsch; import static org.junit.Assert.assertTrue; @@ -24,7 +24,11 @@ import org.eclipse.jgit.junit.ssh.SshBasicTestBase; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.StoredConfig; -import org.eclipse.jgit.transport.OpenSshConfig.Host; +import org.eclipse.jgit.transport.CredentialsProvider; +import org.eclipse.jgit.transport.RemoteSession; +import org.eclipse.jgit.transport.SshSessionFactory; +import org.eclipse.jgit.transport.URIish; +import org.eclipse.jgit.transport.ssh.jsch.OpenSshConfig.Host; import org.eclipse.jgit.util.FS; import com.jcraft.jsch.JSch; diff --git a/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/JSchSshTest.java b/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/JSchSshTest.java index 22caebdac2..54cb84b2f7 100644 --- a/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/JSchSshTest.java +++ b/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/JSchSshTest.java @@ -8,8 +8,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -//TODO(ms): move to org.eclipse.jgit.ssh.jsch in 6.0 -package org.eclipse.jgit.transport; +package org.eclipse.jgit.transport.ssh.jsch; import static org.junit.Assert.assertTrue; @@ -22,7 +21,11 @@ import java.util.Arrays; import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.junit.ssh.SshTestBase; import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.transport.OpenSshConfig.Host; +import org.eclipse.jgit.transport.CredentialsProvider; +import org.eclipse.jgit.transport.RemoteSession; +import org.eclipse.jgit.transport.SshSessionFactory; +import org.eclipse.jgit.transport.URIish; +import org.eclipse.jgit.transport.ssh.jsch.OpenSshConfig.Host; import org.eclipse.jgit.util.FS; import org.junit.experimental.theories.Theories; import org.junit.runner.RunWith; diff --git a/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/JschConfigSessionFactoryTest.java b/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/JschConfigSessionFactoryTest.java index 4efeae1906..4309bedba9 100644 --- a/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/JschConfigSessionFactoryTest.java +++ b/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/JschConfigSessionFactoryTest.java @@ -9,7 +9,7 @@ */ //TODO(ms): move to org.eclipse.jgit.ssh.jsch in 6.0 -package org.eclipse.jgit.transport; +package org.eclipse.jgit.transport.ssh.jsch; import static org.junit.Assert.assertEquals; @@ -19,6 +19,7 @@ import java.util.Arrays; import java.util.concurrent.TimeUnit; import org.eclipse.jgit.junit.MockSystemReader; +import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.util.FS; import org.eclipse.jgit.util.SystemReader; import org.junit.After; diff --git a/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java b/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/OpenSshConfigTest.java index 93d85e2e90..4399ad9be6 100644 --- a/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java +++ b/org.eclipse.jgit.ssh.jsch.test/tst/org/eclipse/jgit/transport/ssh/jsch/OpenSshConfigTest.java @@ -8,8 +8,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -//TODO(ms): move to org.eclipse.jgit.ssh.jsch in 6.0 -package org.eclipse.jgit.transport; +package org.eclipse.jgit.transport.ssh.jsch; import static java.nio.charset.StandardCharsets.UTF_8; import static org.junit.Assert.assertArrayEquals; @@ -29,7 +28,8 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.transport.OpenSshConfig.Host; +import org.eclipse.jgit.transport.SshConstants; +import org.eclipse.jgit.transport.ssh.jsch.OpenSshConfig.Host; import org.eclipse.jgit.util.FS; import org.eclipse.jgit.util.FileUtils; import org.eclipse.jgit.util.SystemReader; diff --git a/org.eclipse.jgit.ssh.jsch/META-INF/MANIFEST.MF b/org.eclipse.jgit.ssh.jsch/META-INF/MANIFEST.MF index 4301692585..1a498ce371 100644 --- a/org.eclipse.jgit.ssh.jsch/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.ssh.jsch/META-INF/MANIFEST.MF @@ -9,12 +9,7 @@ Bundle-Localization: plugin Bundle-ActivationPolicy: lazy Bundle-Version: 6.0.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 -Export-Package: org.eclipse.jgit.internal.transport.jsch;version="6.0.0";x-friends:="org.eclipse.egit.core", - org.eclipse.jgit.transport;version="6.0.0"; - uses:="org.eclipse.jgit.transport, - org.eclipse.jgit.internal.transport.ssh, - org.eclipse.jgit.util, - com.jcraft.jsch" +Export-Package: org.eclipse.jgit.transport.ssh.jsch;version="6.0.0" Import-Package: com.jcraft.jsch;version="[0.1.37,0.2.0)", org.eclipse.jgit.errors;version="[6.0.0,6.1.0)", org.eclipse.jgit.internal;version="[6.0.0,6.1.0)", diff --git a/org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory b/org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory deleted file mode 100644 index 81927466bb..0000000000 --- a/org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.jgit.transport.JschConfigSessionFactory diff --git a/org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.ssh.jsch.SshSessionFactory b/org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.ssh.jsch.SshSessionFactory new file mode 100644 index 0000000000..aca489659e --- /dev/null +++ b/org.eclipse.jgit.ssh.jsch/resources/META-INF/services/org.eclipse.jgit.transport.ssh.jsch.SshSessionFactory @@ -0,0 +1 @@ +org.eclipse.jgit.transport.ssh.jsch.JschConfigSessionFactory diff --git a/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java b/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/internal/transport/ssh/jsch/CredentialsProviderUserInfo.java index 01adcf30b0..5053493005 100644 --- a/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java +++ b/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/internal/transport/ssh/jsch/CredentialsProviderUserInfo.java @@ -8,13 +8,16 @@ * SPDX-License-Identifier: BSD-3-Clause */ -//TODO(ms): move to org.eclipse.jgit.ssh.jsch in 6.0 -package org.eclipse.jgit.transport; +package org.eclipse.jgit.internal.transport.ssh.jsch; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.eclipse.jgit.transport.CredentialItem; +import org.eclipse.jgit.transport.CredentialsProvider; +import org.eclipse.jgit.transport.URIish; + import com.jcraft.jsch.Session; import com.jcraft.jsch.UIKeyboardInteractive; import com.jcraft.jsch.UserInfo; diff --git a/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/internal/transport/jsch/JSchText.java b/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/internal/transport/ssh/jsch/JSchText.java index 4d4c9cb250..c090cd7245 100644 --- a/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/internal/transport/jsch/JSchText.java +++ b/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/internal/transport/ssh/jsch/JSchText.java @@ -7,7 +7,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -package org.eclipse.jgit.internal.transport.jsch; +package org.eclipse.jgit.internal.transport.ssh.jsch; import org.eclipse.jgit.nls.NLS; import org.eclipse.jgit.nls.TranslationBundle; diff --git a/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java b/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/ssh/jsch/JschConfigSessionFactory.java index 88202dd2d6..453433e0c4 100644 --- a/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java +++ b/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/ssh/jsch/JschConfigSessionFactory.java @@ -15,8 +15,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -//TODO(ms): move to org.eclipse.jgit.ssh.jsch in 6.0 -package org.eclipse.jgit.transport; +package org.eclipse.jgit.transport.ssh.jsch; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; @@ -38,7 +37,13 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Stream; import org.eclipse.jgit.errors.TransportException; -import org.eclipse.jgit.internal.transport.jsch.JSchText; +import org.eclipse.jgit.internal.transport.ssh.jsch.CredentialsProviderUserInfo; +import org.eclipse.jgit.internal.transport.ssh.jsch.JSchText; +import org.eclipse.jgit.transport.CredentialsProvider; +import org.eclipse.jgit.transport.RemoteSession; +import org.eclipse.jgit.transport.SshConstants; +import org.eclipse.jgit.transport.SshSessionFactory; +import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.util.FS; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,8 +65,10 @@ import com.jcraft.jsch.Session; * used by C Git. * <p> * The factory does not provide UI behavior. Override the method - * {@link #configure(org.eclipse.jgit.transport.OpenSshConfig.Host, Session)} to - * supply appropriate {@link com.jcraft.jsch.UserInfo} to the session. + * {@link #configure(org.eclipse.jgit.transport.ssh.jsch.OpenSshConfig.Host, Session)} + * to supply appropriate {@link com.jcraft.jsch.UserInfo} to the session. + * + * @since 6.0 */ public class JschConfigSessionFactory extends SshSessionFactory { @@ -177,8 +184,20 @@ public class JschConfigSessionFactory extends SshSessionFactory { return e.getCause() == null && e.getMessage().equals("Auth cancel"); //$NON-NLS-1$ } - // Package visibility for tests - Session createSession(CredentialsProvider credentialsProvider, + /** + * Use for tests only + * + * @param credentialsProvider + * @param fs + * @param user + * @param pass + * @param host + * @param port + * @param hc + * @return session + * @throws JSchException + */ + public Session createSession(CredentialsProvider credentialsProvider, FS fs, String user, final String pass, String host, int port, final OpenSshConfig.Host hc) throws JSchException { final Session session = createSession(hc, user, host, port, fs); @@ -535,7 +554,7 @@ public class JschConfigSessionFactory extends SshSessionFactory { * @param config * to use */ - synchronized void setConfig(OpenSshConfig config) { + public synchronized void setConfig(OpenSshConfig config) { this.config = config; } } diff --git a/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/JschSession.java b/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/ssh/jsch/JschSession.java index c7d0941b62..02cdf70812 100644 --- a/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/JschSession.java +++ b/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/ssh/jsch/JschSession.java @@ -13,8 +13,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -//TODO(ms): move to org.eclipse.jgit.ssh.jsch in 6.0 -package org.eclipse.jgit.transport; +package org.eclipse.jgit.transport.ssh.jsch; import java.io.BufferedOutputStream; import java.io.IOException; @@ -29,7 +28,10 @@ import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import org.eclipse.jgit.errors.TransportException; -import org.eclipse.jgit.internal.transport.jsch.JSchText; +import org.eclipse.jgit.internal.transport.ssh.jsch.JSchText; +import org.eclipse.jgit.transport.FtpChannel; +import org.eclipse.jgit.transport.RemoteSession2; +import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.util.io.IsolatedOutputStream; import com.jcraft.jsch.Channel; @@ -43,8 +45,10 @@ import com.jcraft.jsch.SftpException; * Run remote commands using Jsch. * <p> * This class is the default session implementation using Jsch. Note that - * {@link org.eclipse.jgit.transport.JschConfigSessionFactory} is used to create - * the actual session passed to the constructor. + * {@link org.eclipse.jgit.transport.ssh.jsch.JschConfigSessionFactory} is used to + * create the actual session passed to the constructor. + * + * @since 6.0 */ public class JschSession implements RemoteSession2 { final Session sock; diff --git a/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/OpenSshConfig.java b/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/ssh/jsch/OpenSshConfig.java index 5c6c80c768..2873307e07 100644 --- a/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/OpenSshConfig.java +++ b/org.eclipse.jgit.ssh.jsch/src/org/eclipse/jgit/transport/ssh/jsch/OpenSshConfig.java @@ -8,8 +8,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -//TODO(ms): move to org.eclipse.jgit.ssh.jsch in 6.0 -package org.eclipse.jgit.transport; +package org.eclipse.jgit.transport.ssh.jsch; import static org.eclipse.jgit.internal.transport.ssh.OpenSshConfigFile.positive; @@ -20,6 +19,8 @@ import java.util.TreeMap; import org.eclipse.jgit.internal.transport.ssh.OpenSshConfigFile; import org.eclipse.jgit.internal.transport.ssh.OpenSshConfigFile.HostEntry; +import org.eclipse.jgit.transport.SshConstants; +import org.eclipse.jgit.transport.SshSessionFactory; import org.eclipse.jgit.util.FS; import com.jcraft.jsch.ConfigRepository; @@ -40,7 +41,7 @@ import com.jcraft.jsch.ConfigRepository; * <p> * This parser makes the critical options available to * {@link org.eclipse.jgit.transport.SshSessionFactory} via - * {@link org.eclipse.jgit.transport.OpenSshConfig.Host} objects returned + * {@link org.eclipse.jgit.transport.ssh.jsch.OpenSshConfig.Host} objects returned * by {@link #lookup(String)}, and implements a fully conforming * {@link com.jcraft.jsch.ConfigRepository} providing * {@link com.jcraft.jsch.ConfigRepository.Config}s via @@ -48,6 +49,7 @@ import com.jcraft.jsch.ConfigRepository; * </p> * * @see OpenSshConfigFile + * @since 6.0 */ public class OpenSshConfig implements ConfigRepository { @@ -77,7 +79,15 @@ public class OpenSshConfig implements ConfigRepository { /** The base file. */ private OpenSshConfigFile configFile; - OpenSshConfig(File h, File cfg) { + /** + * Create an OpenSshConfig + * + * @param h + * user's home directory + * @param cfg + * ssh configuration file + */ + public OpenSshConfig(File h, File cfg) { configFile = new OpenSshConfigFile(h, cfg, SshSessionFactory.getLocalUserName()); } @@ -264,7 +274,12 @@ public class OpenSshConfig implements ConfigRepository { } } - Config getConfig() { + /** + * Get the ssh configuration + * + * @return the ssh configuration + */ + public Config getConfig() { if (config == null) { config = new Config() { |