Search in sources :

Example 1 with RemoteAddParams

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);
}
Also used : RemoteAddParams(org.eclipse.che.api.git.params.RemoteAddParams)

Example 2 with RemoteAddParams

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());
}
Also used : RemoteAddParams(org.eclipse.che.api.git.params.RemoteAddParams) GitConnection(org.eclipse.che.api.git.GitConnection) Test(org.testng.annotations.Test)

Aggregations

RemoteAddParams (org.eclipse.che.api.git.params.RemoteAddParams)2 GitConnection (org.eclipse.che.api.git.GitConnection)1 Test (org.testng.annotations.Test)1