use of org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse in project che by eclipse.
the class UpdatePresenter method doUpdate.
protected void doUpdate(final String revision, final String depth, final boolean ignoreExternals, final UpdateToRevisionView view) {
final Project project = appContext.getRootProject();
checkState(project != null);
final Resource[] resources = appContext.getResources();
checkState(!Arrays.isNullOrEmpty(resources));
final StatusNotification notification = new StatusNotification(constants.updateToRevisionStarted(revision), PROGRESS, FLOAT_MODE);
notificationManager.notify(notification);
performOperationWithCredentialsRequestIfNeeded(new RemoteSubversionOperation<CLIOutputWithRevisionResponse>() {
@Override
public Promise<CLIOutputWithRevisionResponse> perform(Credentials credentials) {
notification.setStatus(PROGRESS);
notification.setTitle(constants.updateToRevisionStarted(revision));
return service.update(project.getLocation(), toRelative(project, resources), revision, depth, ignoreExternals, "postpone", credentials);
}
}, notification).then(new Operation<CLIOutputWithRevisionResponse>() {
@Override
public void apply(CLIOutputWithRevisionResponse response) throws OperationException {
printResponse(response.getCommand(), response.getOutput(), response.getErrOutput(), constants.commandUpdate());
notification.setTitle(constants.updateSuccessful(Long.toString(response.getRevision())));
notification.setStatus(SUCCESS);
if (view != null) {
view.close();
}
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
notification.setTitle(constants.updateFailed());
notification.setStatus(FAIL);
}
});
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse in project che by eclipse.
the class SubversionApiITest method testSwitchToBranch.
@Test
public void testSwitchToBranch() throws Exception {
subversionApi.checkout(DtoFactory.getInstance().createDto(CheckoutRequest.class).withProjectPath(tmpDir.toFile().getAbsolutePath()).withUrl(repoUrl + "/trunk"));
CLIOutputWithRevisionResponse response = subversionApi.doSwitch(DtoFactory.getInstance().createDto(SwitchRequest.class).withProjectPath(tmpDir.toFile().getAbsolutePath()).withLocation("^/branches/2.0").withIgnoreAncestry(true));
assertTrue(response.getRevision() > -1);
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse in project che by eclipse.
the class SubversionApiITest method testSwitchToTrunk.
@Test
public void testSwitchToTrunk() throws Exception {
subversionApi.checkout(DtoFactory.getInstance().createDto(CheckoutRequest.class).withProjectPath(tmpDir.toFile().getAbsolutePath()).withUrl(repoUrl + "/tags/1.0"));
CLIOutputWithRevisionResponse response = this.subversionApi.doSwitch(DtoFactory.getInstance().createDto(SwitchRequest.class).withProjectPath(tmpDir.toFile().getAbsolutePath()).withLocation("^/trunk").withIgnoreAncestry(true));
assertTrue(response.getRevision() > -1);
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse in project che by eclipse.
the class SubversionClientServiceImpl method doSwitch.
@Override
public Promise<CLIOutputWithRevisionResponse> doSwitch(String location, Path project, String revision, String depth, String setDepth, String accept, boolean ignoreExternals, boolean ignoreAncestry, boolean relocate, boolean force, @Nullable Credentials credentials) {
SwitchRequest request = dtoFactory.createDto(SwitchRequest.class).withLocation(location).withProjectPath(project.toString()).withDepth(depth).withSetDepth(setDepth).withRelocate(relocate).withIgnoreExternals(ignoreExternals).withIgnoreAncestry(ignoreAncestry).withRevision(revision).withAccept(accept).withForce(force);
if (credentials != null) {
request.setUsername(credentials.getUsername());
request.setPassword(credentials.getPassword());
}
return asyncRequestFactory.createPostRequest(getBaseUrl() + "/switch", request).loader(loader).send(dtoUnmarshallerFactory.newUnmarshaller(CLIOutputWithRevisionResponse.class));
}
use of org.eclipse.che.plugin.svn.shared.CLIOutputWithRevisionResponse in project che by eclipse.
the class SubversionClientServiceImpl method update.
@Override
public Promise<CLIOutputWithRevisionResponse> update(Path project, Path[] paths, String revision, String depth, boolean ignoreExternals, String accept, Credentials credentials) {
final UpdateRequest request = dtoFactory.createDto(UpdateRequest.class).withProjectPath(project.toString()).withPaths(toList(paths)).withRevision(revision).withDepth(depth).withIgnoreExternals(ignoreExternals).withAccept(accept);
if (credentials != null) {
request.setUsername(credentials.getUsername());
request.setPassword(credentials.getPassword());
}
return asyncRequestFactory.createPostRequest(getBaseUrl() + "/update", request).loader(loader).send(dtoUnmarshallerFactory.newUnmarshaller(CLIOutputWithRevisionResponse.class));
}
Aggregations