summaryrefslogtreecommitdiffstats
path: root/java/com/google/gerrit/server/change/PatchSetInserter.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/google/gerrit/server/change/PatchSetInserter.java')
-rw-r--r--java/com/google/gerrit/server/change/PatchSetInserter.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/java/com/google/gerrit/server/change/PatchSetInserter.java b/java/com/google/gerrit/server/change/PatchSetInserter.java
index 209901d65c..fc56e807b7 100644
--- a/java/com/google/gerrit/server/change/PatchSetInserter.java
+++ b/java/com/google/gerrit/server/change/PatchSetInserter.java
@@ -100,6 +100,7 @@ public class PatchSetInserter implements BatchUpdateOp {
private boolean validate = true;
private boolean checkAddPatchSetPermission = true;
private List<String> groups = Collections.emptyList();
+ private ImmutableListMultimap<String, String> validationOptions = ImmutableListMultimap.of();
private boolean fireRevisionCreated = true;
private boolean allowClosed;
private boolean sendEmail = true;
@@ -184,6 +185,13 @@ public class PatchSetInserter implements BatchUpdateOp {
return this;
}
+ public PatchSetInserter setValidationOptions(
+ ImmutableListMultimap<String, String> validationOptions) {
+ requireNonNull(validationOptions, "validationOptions may not be null");
+ this.validationOptions = validationOptions;
+ return this;
+ }
+
public PatchSetInserter setFireRevisionCreated(boolean fireRevisionCreated) {
this.fireRevisionCreated = fireRevisionCreated;
return this;
@@ -298,10 +306,9 @@ public class PatchSetInserter implements BatchUpdateOp {
}
}
- // Approvals that are being set in the new patch-set during this operation are not available yet
- // outside of the scope of this method. Only copied approvals are set here.
if (storeCopiedVotes) {
- approvalsUtil.byPatchSet(ctx.getNotes(), patchSet).forEach(a -> update.putCopiedApproval(a));
+ approvalsUtil.persistCopiedApprovals(
+ ctx.getNotes(), patchSet, ctx.getRevWalk(), ctx.getRepoView().getConfig(), update);
}
return true;
@@ -368,7 +375,7 @@ public class PatchSetInserter implements BatchUpdateOp {
.orElseThrow(illegalState(origNotes.getProjectName()))
.getProject(),
origNotes.getChange().getDest().branch(),
- ImmutableListMultimap.of(),
+ validationOptions,
ctx.getRepoView().getConfig(),
ctx.getRevWalk().getObjectReader(),
commitId,