use of org.eclipse.che.api.git.params.RemoteAddParams in project che by eclipse.
the class RemoteUpdateTest method addInitialRemote.
private void addInitialRemote(GitConnection connection) throws GitException {
RemoteAddParams params = RemoteAddParams.create("newRemote", "newRemote.url").withBranches(singletonList("branch1"));
connection.remoteAdd(params);
}
use of org.eclipse.che.api.git.params.RemoteAddParams in project che by eclipse.
the class RemoteAddTest method testAddNotAllBranchesTracked.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = GitConnectionFactoryProvider.class)
public void testAddNotAllBranchesTracked(GitConnectionFactory connectionFactory) throws GitException, URISyntaxException, IOException, UnauthorizedException {
//given
GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository);
connection.branchCreate("b1", null);
connection.branchCreate("b2", null);
connection.branchCreate("b3", null);
GitConnection connection2 = connectionFactory.getConnection(remoteRepo.getAbsolutePath());
connection2.init(false);
//when
//add remote tracked only to b1 and b3 branches.
RemoteAddParams params = RemoteAddParams.create("origin", connection.getWorkingDir().getAbsolutePath()).withBranches(ImmutableList.of("b1", "b3"));
connection2.remoteAdd(params);
//then
//make pull
connection2.pull(PullParams.create("origin"));
assertTrue(Sets.symmetricDifference(Sets.newHashSet(connection2.branchList(LIST_REMOTE)), Sets.newHashSet(newDto(Branch.class).withName("refs/remotes/origin/b1").withDisplayName("origin/b1").withActive(false).withRemote(true), newDto(Branch.class).withName("refs/remotes/origin/b3").withDisplayName("origin/b3").withActive(false).withRemote(true))).isEmpty());
}
Aggregations