Search in sources :

Example 1 with CommitInfo

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();
    }
}
Also used : TableRowElement(com.google.gwt.dom.client.TableRowElement) TableRowElement(com.google.gwt.dom.client.TableRowElement) Element(com.google.gwt.dom.client.Element) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) CommitInfo(com.google.gerrit.client.info.ChangeInfo.CommitInfo) CopyableLabel(com.google.gwtexpui.clippy.client.CopyableLabel)

Example 2 with CommitInfo

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);
}
Also used : RevisionInfo(com.google.gerrit.client.info.ChangeInfo.RevisionInfo) ActionInfo(com.google.gerrit.client.info.ActionInfo) CommitInfo(com.google.gerrit.client.info.ChangeInfo.CommitInfo)

Example 3 with CommitInfo

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);
}
Also used : RevisionInfo(com.google.gerrit.client.info.ChangeInfo.RevisionInfo) CommitInfo(com.google.gerrit.client.info.ChangeInfo.CommitInfo) GerritUiExtensionPoint(com.google.gerrit.client.GerritUiExtensionPoint)

Example 4 with CommitInfo

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();
}
Also used : CommitInfo(com.google.gerrit.client.info.ChangeInfo.CommitInfo)

Example 5 with CommitInfo

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());
}
Also used : RevisionInfo(com.google.gerrit.client.info.ChangeInfo.RevisionInfo) CommitInfo(com.google.gerrit.client.info.ChangeInfo.CommitInfo) SafeHtmlBuilder(com.google.gwtexpui.safehtml.client.SafeHtmlBuilder)

Aggregations

CommitInfo (com.google.gerrit.client.info.ChangeInfo.CommitInfo)5 RevisionInfo (com.google.gerrit.client.info.ChangeInfo.RevisionInfo)3 GerritUiExtensionPoint (com.google.gerrit.client.GerritUiExtensionPoint)1 ActionInfo (com.google.gerrit.client.info.ActionInfo)1 Element (com.google.gwt.dom.client.Element)1 TableRowElement (com.google.gwt.dom.client.TableRowElement)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 CopyableLabel (com.google.gwtexpui.clippy.client.CopyableLabel)1 SafeHtmlBuilder (com.google.gwtexpui.safehtml.client.SafeHtmlBuilder)1