Support controlling the submit type for changes from Prolog

Similarly like the "submit_rule" there is now a "submit_type" predicate
which returns the allowed submit type for a change. When the submit_type
predicate is not provided in the rules.pl then the project default
submit type is used for all changes for that project.

Filtering the results of the submit_type is also supported in the same
way like filtering the results of the submit_rule. Using a
submit_type_filter predicate one can enforce a particular submit type
from a parent project. For example, a release engineer may want to
enforce the FAST_FORWARD_ONLY submit type for all changes pushed to
stable release branches while, at the same time, use the project wide
default submit type for changes pushed to the development branch.

Change-Id: Iec08f412723856b40324a6e0ec00ac523be9a3b6
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
This commit is contained in:
Sasa Zivkov
2012-08-13 10:46:08 +02:00
committed by Gerrit Code Review
parent 162c801f4b
commit 680a5f80d9
13 changed files with 289 additions and 34 deletions

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.client.changes;
import com.google.gerrit.common.data.AccountInfoCache;
import com.google.gerrit.common.data.SubmitTypeRecord;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSetInfo;
import com.google.gerrit.reviewdb.client.Project;
@@ -37,8 +38,8 @@ public class ChangeDescriptionBlock extends Composite {
}
public void display(Change chg, Boolean starred, PatchSetInfo info,
final AccountInfoCache acc, Project.SubmitType submitType) {
infoBlock.display(chg, acc, submitType);
final AccountInfoCache acc, SubmitTypeRecord submitTypeRecord) {
infoBlock.display(chg, acc, submitTypeRecord);
messageBlock.display(chg.getId(), starred, info.getMessage());
}
}

View File

@@ -21,9 +21,9 @@ import com.google.gerrit.client.ui.AccountLink;
import com.google.gerrit.client.ui.BranchLink;
import com.google.gerrit.client.ui.ProjectLink;
import com.google.gerrit.common.data.AccountInfoCache;
import com.google.gerrit.common.data.SubmitTypeRecord;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
@@ -81,7 +81,7 @@ public class ChangeInfoBlock extends Composite {
}
public void display(final Change chg, final AccountInfoCache acc,
Project.SubmitType submitType) {
SubmitTypeRecord submitTypeRecord) {
final Branch.NameKey dst = chg.getDest();
CopyableLabel changeIdLabel =
@@ -98,8 +98,14 @@ public class ChangeInfoBlock extends Composite {
table.setText(R_UPLOADED, 1, mediumFormat(chg.getCreatedOn()));
table.setText(R_UPDATED, 1, mediumFormat(chg.getLastUpdatedOn()));
table.setText(R_STATUS, 1, Util.toLongString(chg.getStatus()));
table.setText(R_SUBMIT_TYPE, 1,
com.google.gerrit.client.admin.Util.toLongString(submitType));
String submitType;
if (submitTypeRecord.status == SubmitTypeRecord.Status.OK) {
submitType = com.google.gerrit.client.admin.Util
.toLongString(submitTypeRecord.type);
} else {
submitType = submitTypeRecord.status.name();
}
table.setText(R_SUBMIT_TYPE, 1, submitType);
final Change.Status status = chg.getStatus();
if (Gerrit.getConfig().testChangeMerge()) {
if (status.equals(Change.Status.NEW) || status.equals(Change.Status.DRAFT)) {

View File

@@ -282,7 +282,7 @@ public class ChangeScreen extends Screen
descriptionBlock.display(detail.getChange(),
detail.isStarred(),
detail.getCurrentPatchSetDetail().getInfo(),
detail.getAccounts(), detail.getSubmitType());
detail.getAccounts(), detail.getSubmitTypeRecord());
dependsOn.display(detail.getDependsOn());
neededBy.display(detail.getNeededBy());
approvals.display(detail);

View File

@@ -275,7 +275,7 @@ public class PublishCommentScreen extends AccountScreen implements
setPageTitle(Util.M.publishComments(r.getChange().getKey().abbreviate(),
patchSetId.get()));
descBlock.display(r.getChange(), null, r.getPatchSetInfo(), r.getAccounts(),
r.getSubmitType());
r.getSubmitTypeRecord());
if (r.getChange().getStatus().isOpen()) {
initApprovals(r, approvalPanel);