diff options
author | Tomas Ljunggren <tomas.ljunggren@tieto.com> | 2012-01-24 08:16:50 +0100 |
---|---|---|
committer | Tomas Ljunggren <tomas.ljunggren@tieto.com> | 2012-01-24 08:18:15 +0100 |
commit | 5ecbef80da4aaf65fb5356690d1f8b8616f67f3b (patch) | |
tree | f300b1a6dd2fd29e946d1c8e000117ded3fe6c69 | |
parent | e0aefdcb606ce5d2fa269ee157f6c4f03a0d4962 (diff) | |
parent | 514ea19af552cc75fd45afa1b9709fe65181b916 (diff) |
Merge remote-tracking branch 'origin/corrections/qtqainfra-372' into integration/v2.2.1
Change-Id: I85591fa1a3c6cfc632f0ecfebd74bdbcac685795
-rw-r--r-- | gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/StagingApprove.java | 23 |
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 = |