Browse Source

Stop using deprecated methods of RemoteSetUrlCommand/RemoteRemoveCommand

Change-Id: I5234474b359a32bdae501b181f0726be2af1ec6a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
tags/v5.3.0.201903061415-rc1
David Pursehouse 5 years ago
parent
commit
1a2db96c79

+ 5
- 4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Remote.java View File

@@ -53,6 +53,7 @@ import org.eclipse.jgit.api.RemoteAddCommand;
import org.eclipse.jgit.api.RemoteListCommand;
import org.eclipse.jgit.api.RemoteRemoveCommand;
import org.eclipse.jgit.api.RemoteSetUrlCommand;
import org.eclipse.jgit.api.RemoteSetUrlCommand.UriType;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.pgm.internal.CLIText;
import org.eclipse.jgit.pgm.opt.CmdLineParser;
@@ -99,13 +100,13 @@ class Remote extends TextBuiltin {
cmd.call();
} else if ("remove".equals(command) || "rm".equals(command)) { //$NON-NLS-1$ //$NON-NLS-2$
RemoteRemoveCommand cmd = git.remoteRemove();
cmd.setName(name);
cmd.setRemoteName(name);
cmd.call();
} else if ("set-url".equals(command)) { //$NON-NLS-1$
RemoteSetUrlCommand cmd = git.remoteSetUrl();
cmd.setName(name);
cmd.setUri(new URIish(uri));
cmd.setPush(push);
cmd.setRemoteName(name);
cmd.setRemoteUri(new URIish(uri));
cmd.setUriType(push ? UriType.PUSH : UriType.FETCH);
cmd.call();
} else if ("update".equals(command)) { //$NON-NLS-1$
// reuse fetch command for basic implementation of remote update

+ 1
- 1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RemoteDeleteCommandTest.java View File

@@ -56,7 +56,7 @@ public class RemoteDeleteCommandTest extends AbstractRemoteCommandTest {

// execute the command to remove the remote
RemoteRemoveCommand cmd = Git.wrap(db).remoteRemove();
cmd.setName(REMOTE_NAME);
cmd.setRemoteName(REMOTE_NAME);
RemoteConfig remote = cmd.call();

// assert that the removed remote is the initial remote

+ 6
- 5
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RemoteSetUrlCommandTest.java View File

@@ -45,6 +45,7 @@ package org.eclipse.jgit.api;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

import org.eclipse.jgit.api.RemoteSetUrlCommand.UriType;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.URIish;
import org.junit.Test;
@@ -58,9 +59,9 @@ public class RemoteSetUrlCommandTest extends AbstractRemoteCommandTest {

// execute the command to change the fetch url
RemoteSetUrlCommand cmd = Git.wrap(db).remoteSetUrl();
cmd.setName(REMOTE_NAME);
cmd.setRemoteName(REMOTE_NAME);
URIish newUri = new URIish("git://test.com/test");
cmd.setUri(newUri);
cmd.setRemoteUri(newUri);
RemoteConfig remote = cmd.call();

// assert that the changed remote has the new fetch url
@@ -79,10 +80,10 @@ public class RemoteSetUrlCommandTest extends AbstractRemoteCommandTest {

// execute the command to change the push url
RemoteSetUrlCommand cmd = Git.wrap(db).remoteSetUrl();
cmd.setName(REMOTE_NAME);
cmd.setRemoteName(REMOTE_NAME);
URIish newUri = new URIish("git://test.com/test");
cmd.setUri(newUri);
cmd.setPush(true);
cmd.setRemoteUri(newUri);
cmd.setUriType(UriType.PUSH);
RemoteConfig remote = cmd.call();

// assert that the changed remote has the old fetch url and the new push

Loading…
Cancel
Save