Remove ChangeControl.canSubmit(...) methods

All callers but one already had a ChangeData available, so they can
just create their own SubmitRuleEvaluators, and we can get rid of this
ugly method signature.

Change-Id: I21c64f26de10de096f469982e5cf5d10b704e473
This commit is contained in:
Dave Borowitz
2014-10-14 14:30:08 -07:00
parent ff59301a9c
commit bfe384bbb8
5 changed files with 28 additions and 49 deletions

View File

@@ -31,6 +31,7 @@ import com.google.gerrit.server.ApprovalsUtil;
import com.google.gerrit.server.account.AccountInfo;
import com.google.gerrit.server.notedb.ChangeNotes;
import com.google.gerrit.server.project.ChangeControl;
import com.google.gerrit.server.project.SubmitRuleEvaluator;
import com.google.gerrit.server.query.change.ChangeData;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
@@ -109,8 +110,11 @@ public class ReviewerJson {
ChangeData cd = changeDataFactory.create(db.get(), ctl);
PatchSet ps = cd.currentPatchSet();
if (ps != null) {
for (SubmitRecord rec :
ctl.canSubmit(db.get(), ps, cd, true, false, true)) {
for (SubmitRecord rec : new SubmitRuleEvaluator(cd)
.setPatchSet(ps)
.setFastEvalLabels(true)
.setAllowDraft(true)
.canSubmit()) {
if (rec.labels == null) {
continue;
}