summaryrefslogtreecommitdiffstats
path: root/gerrit-server
diff options
context:
space:
mode:
authorIsmo Haataja <ismo.haataja@digia.com>2014-08-13 15:16:30 +0300
committerIsmo Haataja <ismo.haataja@digia.com>2014-10-15 08:48:07 +0200
commit8e105c8e609ec95b9428cffcbb6521cbee5c0269 (patch)
tree4517aa478c0a7c76aa01e4c5603c43a485fef087 /gerrit-server
parent4155ebea0665440b8d8cd1573a32cc400dea8c37 (diff)
Drop review scores if a new patch set pushed during review
While reviewing a change, a new patch set can be pushed. If this happens, review scores are dropped, just comments are saved. Information message is shown to the user. Task-number: QTQAINFRA-874 Change-Id: I1b2443e88bfaacb4f0f2d373a6629b9c2c2c04fb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Ismo Haataja <ismo.haataja@digia.com>
Diffstat (limited to 'gerrit-server')
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java22
1 files changed, 15 insertions, 7 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java
index c8a7c57fb2..2efa6110e5 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java
@@ -181,13 +181,17 @@ public class PostReview implements RestModifyView<RevisionResource, Input> {
Output output = new Output();
output.labels = input.labels;
- if (input.labels != null && input.changeReviewable && change.getStatus().isCI()) {
- output.message =
- "The change was staged while you were reviewing it. " +
- "Due to this, only your comments were published, while your review scores were dropped.";
- }
- else {
- output.message = "";
+ output.message = "";
+ if (input.labels != null && input.changeReviewable) {
+ if (change.getStatus().isCI()) {
+ output.message =
+ "The change was staged while you were reviewing it. " +
+ "Due to this, only your comments were published, while your review scores were dropped.";
+ } else if (!revision.getPatchSet().getId().equals(change.currentPatchSetId())) {
+ output.message =
+ "A new patch set was pushed while you were reviewing the change. " +
+ "Due to this, only your comments were published, while your review scores were dropped.";
+ }
}
return output;
}
@@ -377,6 +381,10 @@ public class PostReview implements RestModifyView<RevisionResource, Input> {
// user is reviewing it. Scores are dropped but comments are kept.
continue;
}
+ if (!rsrc.getPatchSet().getId().equals(change.currentPatchSetId())) {
+ // Scores are also dropped if a new patch set is pushed.
+ continue;
+ }
PatchSetApproval c = current.remove(name);
if (ent.getValue() == null || ent.getValue() == 0) {