summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Ljunggren <tomas.ljunggren@tieto.com>2012-01-24 08:16:50 +0100
committerTomas Ljunggren <tomas.ljunggren@tieto.com>2012-01-24 08:18:15 +0100
commit5ecbef80da4aaf65fb5356690d1f8b8616f67f3b (patch)
treef300b1a6dd2fd29e946d1c8e000117ded3fe6c69
parente0aefdcb606ce5d2fa269ee157f6c4f03a0d4962 (diff)
parent514ea19af552cc75fd45afa1b9709fe65181b916 (diff)
Merge remote-tracking branch 'origin/corrections/qtqainfra-372' into integration/v2.2.1
-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 8167d713bc..9cc6fe3bd8 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
@@ -310,15 +310,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 =