summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Ljunggren <tomas.ljunggren@tieto.com>2011-11-24 10:50:43 +0100
committerTomas Ljunggren <tomas.ljunggren@tieto.com>2011-12-12 17:06:07 +0100
commit514ea19af552cc75fd45afa1b9709fe65181b916 (patch)
treeedc5e9fe923774c72a3fca396acaf31d456864bf
parentbbe1e8d95ee2db8d987555e1d84a222d4a23f3d8 (diff)
Validate topic current change set
Change-Id: Ida30a70d86826073f48222257b27d202c512eb90 Task-number: QTQAINFRA-372 Reviewed-by: Tomas Ljunggren <tomas.ljunggren@tieto.com>
-rw-r--r--gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/StagingApprove.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/StagingApprove.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/StagingApprove.java
index e3d984601b..a03f2ca2df 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/StagingApprove.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/StagingApprove.java
@@ -313,15 +313,22 @@ public class StagingApprove extends BaseCommand {
// TopicChangeControl.
final TopicControl topicControl =
topicControlFactory.validateFor(topicId);
- List<ChangeSet> changeSets = db.changeSets().byTopic(topicId).toList();
- for (ChangeSet changeSet : changeSets) {
- CanSubmitResult result =
- topicControl.canSubmit(db, changeSet.getId(), approvalTypes,
- topicFunctionStateFactory);
- if (result != CanSubmitResult.OK) {
- throw new UnloggedFailure(1, result.getMessage());
- }
+ Topic topic = db.topics().get(topicId);
+ // Only validate most current change set of topic
+ ChangeSet changeSet = db.changeSets().get(topic.currentChangeSetId());
+ CanSubmitResult result = topicControl.canSubmit(db, changeSet.getId(), approvalTypes, topicFunctionStateFactory);
+ if (result != CanSubmitResult.OK) {
+ throw new UnloggedFailure(1, result.getMessage());
}
+// List<ChangeSet> changeSets = db.changeSets().byTopic(topicId).toList();
+// for (ChangeSet changeSet : changeSets) {
+// CanSubmitResult result =
+// topicControl.canSubmit(db, changeSet.getId(), approvalTypes,
+// topicFunctionStateFactory);
+// if (result != CanSubmitResult.OK) {
+// throw new UnloggedFailure(1, result.getMessage());
+// }
+// }
} else {
// Change is not part of a topic. Validate it with ChangeControl.
final ChangeControl changeControl =