Search in sources :

Example 6 with CLIOutputWithRevisionResponse

use of org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse in project che by eclipse.

the class CommitPresenter method doCommit.

private void doCommit(String message, Path[] paths, boolean keepLocks) {
    final Project project = appContext.getRootProject();
    checkState(project != null);
    service.commit(project.getLocation(), paths, message, false, keepLocks).then(new Operation<CLIOutputWithRevisionResponse>() {

        @Override
        public void apply(CLIOutputWithRevisionResponse response) throws OperationException {
            printResponse(response.getCommand(), response.getOutput(), response.getErrOutput(), constants.commandCommit());
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError error) throws OperationException {
            final StatusNotification notification = new StatusNotification(error.getMessage(), FAIL, FLOAT_MODE);
            notificationManager.notify(notification);
        }
    });
    view.onClose();
}
Also used : Project(org.eclipse.che.ide.api.resources.Project) PromiseError(org.eclipse.che.api.promises.client.PromiseError) StatusNotification(org.eclipse.che.ide.api.notification.StatusNotification) CLIOutputWithRevisionResponse(org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse) Operation(org.eclipse.che.api.promises.client.Operation) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 7 with CLIOutputWithRevisionResponse

use of org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse in project che by eclipse.

the class SubversionClientServiceImpl method commit.

@Override
public Promise<CLIOutputWithRevisionResponse> commit(Path project, Path[] paths, String message, boolean keepChangeLists, boolean keepLocks) {
    final String url = getBaseUrl() + "/commit";
    final CommitRequest request = dtoFactory.createDto(CommitRequest.class).withPaths(toList(paths)).withMessage(message).withProjectPath(project.toString()).withKeepChangeLists(keepChangeLists).withKeepLocks(keepLocks);
    return asyncRequestFactory.createPostRequest(url, request).loader(loader).send(dtoUnmarshallerFactory.newUnmarshaller(CLIOutputWithRevisionResponse.class));
}
Also used : CommitRequest(org.eclipse.che.plugin.svn.shared.CommitRequest) CLIOutputWithRevisionResponse(org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse)

Example 8 with CLIOutputWithRevisionResponse

use of org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse in project che by eclipse.

the class SubversionApiITest method testCheckout.

/**
     * Tests for {@link SubversionApi#checkout(CheckoutRequest)}.
     *
     * @throws Exception
     *         if anything goes wrong
     */
@Test
public void testCheckout() throws Exception {
    CLIOutputWithRevisionResponse response = this.subversionApi.checkout(DtoFactory.getInstance().createDto(CheckoutRequest.class).withProjectPath(tmpDir.toFile().getAbsolutePath()).withUrl(repoUrl));
    assertTrue(response.getRevision() > -1);
}
Also used : CLIOutputWithRevisionResponse(org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse) CheckoutRequest(org.eclipse.che.plugin.svn.shared.CheckoutRequest) Test(org.junit.Test)

Example 9 with CLIOutputWithRevisionResponse

use of org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse in project che by eclipse.

the class SubversionApiITest method testUpdate.

/**
     * Tests for {@link SubversionApi#update(UpdateRequest)}.
     *
     * @throws Exception
     *         if anything goes wrong
     */
@Test
public void testUpdate() throws Exception {
    final long coRevision = this.subversionApi.checkout(DtoFactory.getInstance().createDto(CheckoutRequest.class).withProjectPath(tmpDir.toFile().getAbsolutePath()).withUrl(repoUrl).withDepth("immediates")).getRevision();
    final CLIOutputWithRevisionResponse response = this.subversionApi.update(DtoFactory.getInstance().createDto(UpdateRequest.class).withProjectPath(tmpDir.toFile().getAbsolutePath()));
    assertTrue(coRevision > -1);
    assertTrue(response.getRevision() > -1);
    assertTrue(coRevision <= response.getRevision());
}
Also used : CheckoutRequest(org.eclipse.che.plugin.svn.shared.CheckoutRequest) CLIOutputWithRevisionResponse(org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse) Test(org.junit.Test)

Example 10 with CLIOutputWithRevisionResponse

use of org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse in project che by eclipse.

the class SubversionApiITest method testSwitchToTag.

@Test
public void testSwitchToTag() throws Exception {
    subversionApi.checkout(DtoFactory.getInstance().createDto(CheckoutRequest.class).withProjectPath(tmpDir.toFile().getAbsolutePath()).withUrl(repoUrl + "/trunk"));
    CLIOutputWithRevisionResponse response = this.subversionApi.doSwitch(DtoFactory.getInstance().createDto(SwitchRequest.class).withProjectPath(tmpDir.toFile().getAbsolutePath()).withLocation("^/tags/1.0").withIgnoreAncestry(true));
    assertTrue(response.getRevision() > -1);
}
Also used : CheckoutRequest(org.eclipse.che.plugin.svn.shared.CheckoutRequest) CLIOutputWithRevisionResponse(org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse) Test(org.junit.Test)

Aggregations

CLIOutputWithRevisionResponse (org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse)11 CheckoutRequest (org.eclipse.che.plugin.svn.shared.CheckoutRequest)6 Test (org.junit.Test)5 Operation (org.eclipse.che.api.promises.client.Operation)2 OperationException (org.eclipse.che.api.promises.client.OperationException)2 PromiseError (org.eclipse.che.api.promises.client.PromiseError)2 StatusNotification (org.eclipse.che.ide.api.notification.StatusNotification)2 Project (org.eclipse.che.ide.api.resources.Project)2 CommitRequest (org.eclipse.che.plugin.svn.shared.CommitRequest)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Promise (org.eclipse.che.api.promises.client.Promise)1 Resource (org.eclipse.che.ide.api.resources.Resource)1 Credentials (org.eclipse.che.ide.api.subversion.Credentials)1 CommandLineResult (org.eclipse.che.plugin.svn.server.upstream.CommandLineResult)1 CLIOutputResponse (org.eclipse.che.plugin.svn.shared.CLIOutputResponse)1 PropertySetRequest (org.eclipse.che.plugin.svn.shared.PropertySetRequest)1 SwitchRequest (org.eclipse.che.plugin.svn.shared.SwitchRequest)1 UpdateRequest (org.eclipse.che.plugin.svn.shared.UpdateRequest)1