use of org.eclipse.che.api.git.shared.Revision in project che by eclipse.
the class GitServiceClientImpl method commit.
@Override
public Promise<Revision> commit(DevMachine devMachine, Path project, String message, boolean all, boolean amend) {
CommitRequest commitRequest = dtoFactory.createDto(CommitRequest.class).withMessage(message).withAmend(amend).withAll(all);
String url = devMachine.getWsAgentBaseUrl() + COMMIT + "?projectPath=" + project;
return asyncRequestFactory.createPostRequest(url, commitRequest).loader(loader).send(dtoUnmarshallerFactory.newUnmarshaller(Revision.class));
}
use of org.eclipse.che.api.git.shared.Revision in project che by eclipse.
the class RevisionListViewImpl method createRevisionsTable.
private void createRevisionsTable(org.eclipse.che.ide.Resources coreRes) {
Column<Revision, String> idColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getId().substring(0, 8) + "...";
}
};
Column<Revision, String> timeColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return dateTimeFormatter.getFormattedDate(revision.getCommitTime());
}
};
Column<Revision, String> authorColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getCommitter().getName();
}
};
Column<Revision, String> titleColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getMessage().substring(0, 50);
}
};
revisions = new CellTable<>(15, coreRes);
revisions.setWidth("100%");
revisions.addColumn(idColumn, locale.viewCompareRevisionTableIdTitle());
revisions.addColumn(timeColumn, locale.viewCompareRevisionTableTimeTitle());
revisions.addColumn(authorColumn, locale.viewCompareRevisionTableAuthorTitle());
revisions.addColumn(titleColumn, locale.viewCompareRevisionTableTitleTitle());
selectionModel = new SingleSelectionModel<Revision>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
description.setText(selectionModel.getSelectedObject().getMessage());
delegate.onRevisionSelected(selectionModel.getSelectedObject());
}
});
revisions.setSelectionModel(selectionModel);
revisions.addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
delegate.onRevisionDoubleClicked();
}
}, DoubleClickEvent.getType());
this.revisionsPanel.add(revisions);
}
use of org.eclipse.che.api.git.shared.Revision in project che by eclipse.
the class HistoryViewImpl method createRevisionsTable.
private void createRevisionsTable(org.eclipse.che.ide.Resources coreRes) {
Column<Revision, String> idColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getId().substring(0, 8) + "...";
}
};
Column<Revision, String> timeColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return dateTimeFormatter.getFormattedDate(revision.getCommitTime());
}
};
Column<Revision, String> authorColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getCommitter().getName();
}
};
Column<Revision, String> titleColumn = new Column<Revision, String>(new TextCell()) {
@Override
public String getValue(Revision revision) {
return revision.getMessage().substring(0, 50);
}
};
revisions = new CellTable<>(15, coreRes);
revisions.setWidth("100%");
revisions.addColumn(idColumn, locale.viewCompareRevisionTableIdTitle());
revisions.addColumn(timeColumn, locale.viewCompareRevisionTableTimeTitle());
revisions.addColumn(authorColumn, locale.viewCompareRevisionTableAuthorTitle());
revisions.addColumn(titleColumn, locale.viewCompareRevisionTableTitleTitle());
selectionModel = new SingleSelectionModel<Revision>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
description.setText(selectionModel.getSelectedObject().getMessage());
delegate.onRevisionSelected(selectionModel.getSelectedObject());
}
});
revisions.setSelectionModel(selectionModel);
revisions.addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(DoubleClickEvent event) {
delegate.onRevisionDoubleClicked();
}
}, DoubleClickEvent.getType());
this.revisionsPanel.add(revisions);
}
use of org.eclipse.che.api.git.shared.Revision in project che by eclipse.
the class LogPage method writeTo.
/** @see InfoPage#writeTo(java.io.OutputStream) */
@Override
public void writeTo(OutputStream out) throws IOException {
PrintWriter writer = new PrintWriter(out);
DateFormat df = (DateFormat) dateFormat.clone();
for (Revision commit : commits) {
writer.format("commit %s\n", commit.getId());
GitUser commiter = commit.getCommitter();
if (commiter != null) {
writer.format("Author: %1$s <%2$s>\n", commiter.getName(), commiter.getEmail());
}
long commitTime = commit.getCommitTime();
if (commitTime > 0) {
writer.format("Date: %s\n", df.format(new Date(commitTime)));
}
writer.println();
// Message with indent.
String[] lines = commit.getMessage().split("\n");
for (String line : lines) {
writer.format(" %s\n", line);
}
writer.println();
}
writer.flush();
}
use of org.eclipse.che.api.git.shared.Revision in project che by eclipse.
the class CommitTest method testSimpleCommit.
@Test(dataProvider = "GitConnectionFactory", dataProviderClass = org.eclipse.che.git.impl.GitConnectionFactoryProvider.class)
public void testSimpleCommit(GitConnectionFactory connectionFactory) throws GitException, IOException {
//given
GitConnection connection = connectToInitializedGitRepository(connectionFactory, repository);
//add new File
addFile(connection, "DONTREADME", "secret");
//add changes
connection.add(AddParams.create(AddRequest.DEFAULT_PATTERN));
//when
CommitParams commitParams = CommitParams.create("Commit message").withAmend(false).withAll(false);
Revision revision = connection.commit(commitParams);
//then
assertEquals(revision.getMessage(), commitParams.getMessage());
}
Aggregations