Merge "Always keep Submit button enabled even if change is not mergeable"
This commit is contained in:
@@ -813,15 +813,6 @@ master node startup.
|
|||||||
+
|
+
|
||||||
Default is 300 seconds (5 minutes).
|
Default is 300 seconds (5 minutes).
|
||||||
|
|
||||||
[[changeMerge.test]]changeMerge.test::
|
|
||||||
+
|
|
||||||
Controls whether or not the mergeability test of changes is
|
|
||||||
enabled. If enabled, when the change page is loaded, the test is
|
|
||||||
triggered. The submit button will be enabled or disabled according to
|
|
||||||
the result.
|
|
||||||
+
|
|
||||||
By default this is false (test is not enabled).
|
|
||||||
|
|
||||||
[[changeMerge.threadPoolSize]]changeMerge.threadPoolSize::
|
[[changeMerge.threadPoolSize]]changeMerge.threadPoolSize::
|
||||||
+
|
+
|
||||||
Maximum size of the thread pool in which the mergeability flag of open
|
Maximum size of the thread pool in which the mergeability flag of open
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ public class GerritConfig implements Cloneable {
|
|||||||
protected Project.NameKey wildProject;
|
protected Project.NameKey wildProject;
|
||||||
protected Set<Account.FieldName> editableAccountFields;
|
protected Set<Account.FieldName> editableAccountFields;
|
||||||
protected boolean documentationAvailable;
|
protected boolean documentationAvailable;
|
||||||
protected boolean testChangeMerge;
|
|
||||||
protected String anonymousCowardName;
|
protected String anonymousCowardName;
|
||||||
protected int suggestFrom;
|
protected int suggestFrom;
|
||||||
protected int changeUpdateDelay;
|
protected int changeUpdateDelay;
|
||||||
@@ -234,14 +233,6 @@ public class GerritConfig implements Cloneable {
|
|||||||
documentationAvailable = available;
|
documentationAvailable = available;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean testChangeMerge() {
|
|
||||||
return testChangeMerge;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTestChangeMerge(final boolean test) {
|
|
||||||
testChangeMerge = test;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAnonymousCowardName() {
|
public String getAnonymousCowardName() {
|
||||||
return anonymousCowardName;
|
return anonymousCowardName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ class Actions extends Composite {
|
|||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSubmitEnabled(boolean ok) {
|
void setSubmitEnabled() {
|
||||||
submit.setVisible(ok && canSubmit);
|
submit.setVisible(canSubmit);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isSubmitEnabled() {
|
boolean isSubmitEnabled() {
|
||||||
|
|||||||
@@ -662,7 +662,7 @@ public class ChangeScreen2 extends Screen {
|
|||||||
|
|
||||||
private void loadSubmitType(final Change.Status status, final boolean canSubmit) {
|
private void loadSubmitType(final Change.Status status, final boolean canSubmit) {
|
||||||
if (canSubmit) {
|
if (canSubmit) {
|
||||||
actions.setSubmitEnabled(true);
|
actions.setSubmitEnabled();
|
||||||
if (status == Change.Status.NEW) {
|
if (status == Change.Status.NEW) {
|
||||||
statusText.setInnerText(Util.C.readyToSubmit());
|
statusText.setInnerText(Util.C.readyToSubmit());
|
||||||
}
|
}
|
||||||
@@ -672,17 +672,14 @@ public class ChangeScreen2 extends Screen {
|
|||||||
.get(new AsyncCallback<NativeString>() {
|
.get(new AsyncCallback<NativeString>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(NativeString result) {
|
public void onSuccess(NativeString result) {
|
||||||
if (Gerrit.getConfig().testChangeMerge()) {
|
if (canSubmit) {
|
||||||
if (canSubmit) {
|
if (status == Change.Status.NEW) {
|
||||||
actions.setSubmitEnabled(changeInfo.mergeable());
|
statusText.setInnerText(changeInfo.mergeable()
|
||||||
if (status == Change.Status.NEW) {
|
? Util.C.readyToSubmit()
|
||||||
statusText.setInnerText(changeInfo.mergeable()
|
: Util.C.mergeConflict());
|
||||||
? Util.C.readyToSubmit()
|
|
||||||
: Util.C.mergeConflict());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
setVisible(notMergeable, !changeInfo.mergeable());
|
|
||||||
}
|
}
|
||||||
|
setVisible(notMergeable, !changeInfo.mergeable());
|
||||||
|
|
||||||
renderSubmitType(result.asString());
|
renderSubmitType(result.asString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,8 +164,7 @@ public class ApprovalTable extends Composite {
|
|||||||
table.setVisible(true);
|
table.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Gerrit.getConfig().testChangeMerge()
|
if (change.status() != Change.Status.MERGED
|
||||||
&& change.status() != Change.Status.MERGED
|
|
||||||
&& !change.mergeable()) {
|
&& !change.mergeable()) {
|
||||||
addMissingLabel(Util.C.messageNeedsRebaseOrHasDependency());
|
addMissingLabel(Util.C.messageNeedsRebaseOrHasDependency());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,11 +60,7 @@ public class ChangeInfoBlock extends Composite {
|
|||||||
private final Grid table;
|
private final Grid table;
|
||||||
|
|
||||||
public ChangeInfoBlock() {
|
public ChangeInfoBlock() {
|
||||||
if (Gerrit.getConfig().testChangeMerge()) {
|
table = new Grid(R_CNT, 2);
|
||||||
table = new Grid(R_CNT, 2);
|
|
||||||
} else {
|
|
||||||
table = new Grid(R_CNT - 1, 2);
|
|
||||||
}
|
|
||||||
table.setStyleName(Gerrit.RESOURCES.css().infoBlock());
|
table.setStyleName(Gerrit.RESOURCES.css().infoBlock());
|
||||||
table.addStyleName(Gerrit.RESOURCES.css().changeInfoBlock());
|
table.addStyleName(Gerrit.RESOURCES.css().changeInfoBlock());
|
||||||
|
|
||||||
@@ -77,9 +73,7 @@ public class ChangeInfoBlock extends Composite {
|
|||||||
initRow(R_UPDATED, Util.C.changeInfoBlockUpdated());
|
initRow(R_UPDATED, Util.C.changeInfoBlockUpdated());
|
||||||
initRow(R_STATUS, Util.C.changeInfoBlockStatus());
|
initRow(R_STATUS, Util.C.changeInfoBlockStatus());
|
||||||
initRow(R_SUBMIT_TYPE, Util.C.changeInfoBlockSubmitType());
|
initRow(R_SUBMIT_TYPE, Util.C.changeInfoBlockSubmitType());
|
||||||
if (Gerrit.getConfig().testChangeMerge()) {
|
initRow(R_MERGE_TEST, Util.C.changeInfoBlockCanMerge());
|
||||||
initRow(R_MERGE_TEST, Util.C.changeInfoBlockCanMerge());
|
|
||||||
}
|
|
||||||
|
|
||||||
final CellFormatter fmt = table.getCellFormatter();
|
final CellFormatter fmt = table.getCellFormatter();
|
||||||
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
|
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
|
||||||
@@ -128,14 +122,12 @@ public class ChangeInfoBlock extends Composite {
|
|||||||
}
|
}
|
||||||
table.setText(R_SUBMIT_TYPE, 1, submitType);
|
table.setText(R_SUBMIT_TYPE, 1, submitType);
|
||||||
final Change.Status status = chg.getStatus();
|
final Change.Status status = chg.getStatus();
|
||||||
if (Gerrit.getConfig().testChangeMerge()) {
|
if (status.equals(Change.Status.NEW) || status.equals(Change.Status.DRAFT)) {
|
||||||
if (status.equals(Change.Status.NEW) || status.equals(Change.Status.DRAFT)) {
|
table.getRowFormatter().setVisible(R_MERGE_TEST, true);
|
||||||
table.getRowFormatter().setVisible(R_MERGE_TEST, true);
|
table.setText(R_MERGE_TEST, 1, chg.isMergeable() ? Util.C
|
||||||
table.setText(R_MERGE_TEST, 1, chg.isMergeable() ? Util.C
|
.changeInfoBlockCanMergeYes() : Util.C.changeInfoBlockCanMergeNo());
|
||||||
.changeInfoBlockCanMergeYes() : Util.C.changeInfoBlockCanMergeNo());
|
} else {
|
||||||
} else {
|
table.getRowFormatter().setVisible(R_MERGE_TEST, false);
|
||||||
table.getRowFormatter().setVisible(R_MERGE_TEST, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status.isClosed()) {
|
if (status.isClosed()) {
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
|
|||||||
Change.Status status = c.status();
|
Change.Status status = c.status();
|
||||||
if (status != Change.Status.NEW) {
|
if (status != Change.Status.NEW) {
|
||||||
table.setText(row, C_STATUS, Util.toLongString(status));
|
table.setText(row, C_STATUS, Util.toLongString(status));
|
||||||
} else if (Gerrit.getConfig().testChangeMerge() && !c.mergeable()) {
|
} else if (!c.mergeable()) {
|
||||||
table.setText(row, C_STATUS, Util.C.changeTableNotMergeable());
|
table.setText(row, C_STATUS, Util.C.changeTableNotMergeable());
|
||||||
table.getCellFormatter().addStyleName(row, C_STATUS, Gerrit.RESOURCES.css().notMergeable());
|
table.getCellFormatter().addStyleName(row, C_STATUS, Gerrit.RESOURCES.css().notMergeable());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -312,10 +312,6 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
|
|||||||
final Button b =
|
final Button b =
|
||||||
new Button(Util.M
|
new Button(Util.M
|
||||||
.submitPatchSet(detail.getPatchSet().getPatchSetId()));
|
.submitPatchSet(detail.getPatchSet().getPatchSetId()));
|
||||||
if (Gerrit.getConfig().testChangeMerge()) {
|
|
||||||
b.setEnabled(changeDetail.getChange().isMergeable());
|
|
||||||
}
|
|
||||||
|
|
||||||
b.addClickHandler(new ClickHandler() {
|
b.addClickHandler(new ClickHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final ClickEvent event) {
|
public void onClick(final ClickEvent event) {
|
||||||
|
|||||||
@@ -376,9 +376,6 @@ public class PublishCommentScreen extends AccountScreen implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
submit.setVisible(r.canSubmit());
|
submit.setVisible(r.canSubmit());
|
||||||
if (Gerrit.getConfig().testChangeMerge()) {
|
|
||||||
submit.setEnabled(r.getChange().isMergeable());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSend(final boolean submit) {
|
private void onSend(final boolean submit) {
|
||||||
|
|||||||
@@ -123,8 +123,6 @@ class GerritConfigProvider implements Provider<GerritConfig> {
|
|||||||
config.setWildProject(wildProject);
|
config.setWildProject(wildProject);
|
||||||
config.setDocumentationAvailable(servletContext
|
config.setDocumentationAvailable(servletContext
|
||||||
.getResource("/Documentation/index.html") != null);
|
.getResource("/Documentation/index.html") != null);
|
||||||
config.setTestChangeMerge(cfg.getBoolean("changeMerge",
|
|
||||||
"test", false));
|
|
||||||
config.setAnonymousCowardName(anonymousCowardName);
|
config.setAnonymousCowardName(anonymousCowardName);
|
||||||
config.setSuggestFrom(cfg.getInt("suggest", "from", 0));
|
config.setSuggestFrom(cfg.getInt("suggest", "from", 0));
|
||||||
config.setChangeUpdateDelay((int) ConfigUtil.getTimeUnit(
|
config.setChangeUpdateDelay((int) ConfigUtil.getTimeUnit(
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ public class ChangeDetailFactory extends Handler<ChangeDetail> {
|
|||||||
private Map<PatchSet.Id, PatchSet> patchsetsById;
|
private Map<PatchSet.Id, PatchSet> patchsetsById;
|
||||||
|
|
||||||
private final Mergeable mergeable;
|
private final Mergeable mergeable;
|
||||||
private boolean testMerge;
|
|
||||||
|
|
||||||
private List<PatchSetAncestor> currentPatchSetAncestors;
|
private List<PatchSetAncestor> currentPatchSetAncestors;
|
||||||
private List<PatchSet> currentDepPatchSets;
|
private List<PatchSet> currentDepPatchSets;
|
||||||
@@ -112,7 +111,6 @@ public class ChangeDetailFactory extends Handler<ChangeDetail> {
|
|||||||
this.aic = accountInfoCacheFactory.create();
|
this.aic = accountInfoCacheFactory.create();
|
||||||
|
|
||||||
this.mergeable = mergeable;
|
this.mergeable = mergeable;
|
||||||
this.testMerge = cfg.getBoolean("changeMerge", "test", false);
|
|
||||||
|
|
||||||
this.changeId = id;
|
this.changeId = id;
|
||||||
}
|
}
|
||||||
@@ -231,8 +229,7 @@ public class ChangeDetailFactory extends Handler<ChangeDetail> {
|
|||||||
private void load() throws OrmException, NoSuchChangeException,
|
private void load() throws OrmException, NoSuchChangeException,
|
||||||
NoSuchProjectException {
|
NoSuchProjectException {
|
||||||
final Change.Status status = detail.getChange().getStatus();
|
final Change.Status status = detail.getChange().getStatus();
|
||||||
if ((status.equals(Change.Status.NEW) || status.equals(Change.Status.DRAFT)) &&
|
if ((status.equals(Change.Status.NEW) || status.equals(Change.Status.DRAFT))) {
|
||||||
testMerge) {
|
|
||||||
try {
|
try {
|
||||||
detail.getChange().setMergeable(mergeable.apply(new RevisionResource(
|
detail.getChange().setMergeable(mergeable.apply(new RevisionResource(
|
||||||
new ChangeResource(control),
|
new ChangeResource(control),
|
||||||
|
|||||||
Reference in New Issue
Block a user