use of com.google.gerrit.client.info.ChangeInfo.CommitInfo in project gerrit by GerritCodeReview.
the class CommitBox method setParents.
private void setParents(JsArray<CommitInfo> commits) {
setVisible(firstParent, true);
TableRowElement next = firstParent;
TableRowElement previous = null;
for (CommitInfo c : Natives.asList(commits)) {
if (next == firstParent) {
CopyableLabel copyLabel = getCommitLabel(c);
parentCommits.add(copyLabel);
setWebLinks(parentWebLinks, c);
} else {
next.appendChild(DOM.createTD());
Element td1 = DOM.createTD();
td1.appendChild(getCommitLabel(c).getElement());
next.appendChild(td1);
FlowPanel linksPanel = new FlowPanel();
linksPanel.addStyleName(style.parentWebLink());
setWebLinks(linksPanel, c);
Element td2 = DOM.createTD();
td2.appendChild(linksPanel.getElement());
next.appendChild(td2);
previous.getParentElement().insertAfter(next, previous);
}
previous = next;
next = DOM.createTR().cast();
}
}
use of com.google.gerrit.client.info.ChangeInfo.CommitInfo in project gerrit by GerritCodeReview.
the class Actions method display.
void display(ChangeInfo info, String revision) {
this.revision = revision;
boolean hasUser = Gerrit.isSignedIn();
RevisionInfo revInfo = info.revision(revision);
CommitInfo commit = revInfo.commit();
changeId = info.legacyId();
project = info.project();
topic = info.topic();
subject = commit.subject();
message = commit.message();
branch = info.branch();
key = info.changeId();
changeInfo = info;
initChangeActions(info, hasUser);
NativeMap<ActionInfo> actionMap = revInfo.hasActions() ? revInfo.actions() : NativeMap.<ActionInfo>create();
actionMap.copyKeysIntoChildren("id");
reloadRevisionActions(actionMap);
}
use of com.google.gerrit.client.info.ChangeInfo.CommitInfo in project gerrit by GerritCodeReview.
the class ChangeScreen method renderDiffBaseListBox.
private void renderDiffBaseListBox(ChangeInfo info) {
JsArray<RevisionInfo> list = info.revisions().values();
RevisionInfo.sortRevisionInfoByNumber(list);
int selectedIdx = list.length();
for (int i = list.length() - 1; i >= 0; i--) {
RevisionInfo r = list.get(i);
diffBase.addItem(r.id() + ": " + r.name().substring(0, 6), r.id());
if (r.name().equals(revision)) {
SelectElement.as(diffBase.getElement()).getOptions().getItem(diffBase.getItemCount() - 1).setDisabled(true);
}
if (base.isPatchSet() && base.asPatchSetId().get() == r._number()) {
selectedIdx = diffBase.getItemCount() - 1;
}
}
RevisionInfo rev = info.revisions().get(revision);
JsArray<CommitInfo> parents = rev.commit().parents();
if (parents.length() > 1) {
diffBase.addItem(Util.C.autoMerge(), DiffObject.AUTO_MERGE);
for (int i = 0; i < parents.length(); i++) {
int parentNum = i + 1;
diffBase.addItem(Util.M.diffBaseParent(parentNum), String.valueOf(-parentNum));
}
if (base.isParent()) {
selectedIdx = list.length() + base.getParentNum();
}
} else {
diffBase.addItem(Util.C.baseDiffItem(), "");
}
diffBase.setSelectedIndex(selectedIdx);
}
use of com.google.gerrit.client.info.ChangeInfo.CommitInfo in project gerrit by GerritCodeReview.
the class PatchSetsBox method revision.
private void revision(SafeHtmlBuilder sb, int index, RevisionInfo r) {
CommitInfo c = r.commit();
sb.openTr();
if (revision.equals(r.name())) {
sb.setStyleName(style.current());
}
sb.openTd().setStyleName(style.legacy_id());
if (r.draft()) {
sb.append(Resources.C.draft()).append(' ');
}
sb.append(r.id());
sb.closeTd();
sb.openTd().setStyleName(style.commit()).openAnchor().setAttribute("href", "#" + url(r)).setAttribute("onclick", OPEN + "(event," + index + ")").append(r.name().substring(0, 10)).closeAnchor().closeTd();
sb.openTd().append(FormatUtil.shortFormatDayTime(c.committer().date())).closeTd();
String an = c.author() != null ? c.author().name() : "";
String cn = c.committer() != null ? c.committer().name() : "";
sb.openTd();
sb.append(an);
if (!"".equals(an) && !"".equals(cn) && !an.equals(cn)) {
sb.append(" / ").append(cn);
}
sb.closeTd();
sb.closeTr();
}
use of com.google.gerrit.client.info.ChangeInfo.CommitInfo in project gerrit by GerritCodeReview.
the class CommitBox method set.
void set(CommentLinkProcessor commentLinkProcessor, ChangeInfo change, String revision) {
RevisionInfo revInfo = change.revision(revision);
CommitInfo commit = revInfo.commit();
commitName.setText(revision);
idText.setText("Change-Id: " + change.changeId());
idText.setPreviewText(change.changeId());
formatLink(commit.author(), authorPanel, authorNameEmail, authorDate, change);
formatLink(commit.committer(), committerPanel, committerNameEmail, committerDate, change);
text.setHTML(commentLinkProcessor.apply(new SafeHtmlBuilder().append(commit.message()).linkify()));
setWebLinks(webLinkPanel, revInfo.commit());
if (revInfo.commit().parents().length() > 1) {
mergeCommit.setVisible(true);
}
setParents(revInfo.commit().parents());
}
Aggregations