Submit whole topic: check if all changes are submittable

We were checking only if the current change was submittable, but we
really need to check all changes.

Change-Id: Ief424e7bd32f5d552b3adc18fc3c7c2ff7c46df2
This commit is contained in:
Stefan Beller
2015-02-06 14:23:43 -08:00
parent 252d769b51
commit 0145e70478

View File

@@ -391,16 +391,20 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
ReviewDb db = dbProvider.get();
ChangeData cd = changeDataFactory.create(db, rsrc.getControl());
List<SubmitRecord> submitRecords = checkSubmitRule(cd,
rsrc.getPatchSet(), force);
List<ChangeData> changesByTopic = queryProvider.get().byTopicOpen(topic);
String problems = problemsForSubmittingChanges(changesByTopic, caller);
if (problems != null) {
throw new ResourceConflictException(problems);
}
Change change = rsrc.getChange();
ChangeUpdate update = updateFactory.create(rsrc.getControl(), timestamp);
List<SubmitRecord> submitRecords = checkSubmitRule(cd,
rsrc.getPatchSet(), force);
update.submit(submitRecords);
db.changes().beginTransaction(change.getId());
List<ChangeData> changesByTopic = queryProvider.get().byTopicOpen(topic);
try {
BatchMetaDataUpdate batch = approve(rsrc, update, caller, timestamp);
// Write update commit after all normalized label commits.