use of org.eclipse.che.api.git.shared.PushResponse in project che by eclipse.
the class PushToRemotePresenter method onPushClicked.
/** {@inheritDoc} */
@Override
public void onPushClicked() {
final StatusNotification notification = notificationManager.notify(constant.pushProcess(), PROGRESS, FLOAT_MODE);
final String repository = view.getRepository();
final GitOutputConsole console = gitOutputConsoleFactory.create(PUSH_COMMAND_NAME);
service.push(appContext.getDevMachine(), project.getLocation(), getRefs(), repository, false).then(new Operation<PushResponse>() {
@Override
public void apply(PushResponse response) throws OperationException {
console.print(response.getCommandOutput());
processesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notification.setStatus(SUCCESS);
if (response.getCommandOutput().contains("Everything up-to-date")) {
notification.setTitle(constant.pushUpToDate());
} else {
notification.setTitle(constant.pushSuccess(repository));
}
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
handleError(error.getCause(), notification, console);
processesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
}
});
view.close();
}
use of org.eclipse.che.api.git.shared.PushResponse in project che by eclipse.
the class PushTest method testPushWhenLocalRepositoryIsUpToDate.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testPushWhenLocalRepositoryIsUpToDate(GitConnectionFactory connectionFactory) throws IOException, ServerException, URISyntaxException, UnauthorizedException {
//given
GitConnection remoteConnection = connectToGitRepositoryWithContent(connectionFactory, repository);
GitConnection localConnection = connectionFactory.getConnection(remoteRepo.getAbsolutePath());
localConnection.clone(CloneParams.create(remoteConnection.getWorkingDir().getAbsolutePath()));
//when
PushResponse pushResponse = localConnection.push(PushParams.create("origin").withRefSpec(singletonList("refs/heads/master:refs/heads/master")).withTimeout(-1));
//then
assertEquals(pushResponse.getCommandOutput(), "Everything up-to-date");
}
Aggregations