MergeValidationListener: Include the change Id in onPreMerge
Bug: Issue 11905 Change-Id: Ib0a65d12991b768f169cfe7fd562dcf8defc4d74
This commit is contained in:
@@ -16,6 +16,7 @@ package com.google.gerrit.server.git.validators;
|
||||
|
||||
import com.google.gerrit.extensions.annotations.ExtensionPoint;
|
||||
import com.google.gerrit.reviewdb.client.Branch;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.git.CodeReviewCommit;
|
||||
@@ -45,6 +46,7 @@ public interface MergeValidationListener {
|
||||
CodeReviewCommit commit,
|
||||
ProjectState destProject,
|
||||
Branch.NameKey destBranch,
|
||||
Change.Id changeId,
|
||||
PatchSet.Id patchSetId,
|
||||
IdentifiedUser caller)
|
||||
throws MergeValidationException;
|
||||
|
@@ -23,6 +23,7 @@ import com.google.gerrit.extensions.registration.Extension;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Branch;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.client.RefNames;
|
||||
@@ -83,6 +84,7 @@ public class MergeValidators {
|
||||
CodeReviewCommit commit,
|
||||
ProjectState destProject,
|
||||
Branch.NameKey destBranch,
|
||||
Change.Id changeId,
|
||||
PatchSet.Id patchSetId,
|
||||
IdentifiedUser caller)
|
||||
throws MergeValidationException {
|
||||
@@ -94,7 +96,7 @@ public class MergeValidators {
|
||||
groupValidatorFactory.create());
|
||||
|
||||
for (MergeValidationListener validator : validators) {
|
||||
validator.onPreMerge(repo, commit, destProject, destBranch, patchSetId, caller);
|
||||
validator.onPreMerge(repo, commit, destProject, destBranch, changeId, patchSetId, caller);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +158,7 @@ public class MergeValidators {
|
||||
final CodeReviewCommit commit,
|
||||
final ProjectState destProject,
|
||||
final Branch.NameKey destBranch,
|
||||
final Change.Id changeId,
|
||||
final PatchSet.Id patchSetId,
|
||||
IdentifiedUser caller)
|
||||
throws MergeValidationException {
|
||||
@@ -251,11 +254,12 @@ public class MergeValidators {
|
||||
CodeReviewCommit commit,
|
||||
ProjectState destProject,
|
||||
Branch.NameKey destBranch,
|
||||
Change.Id changeId,
|
||||
PatchSet.Id patchSetId,
|
||||
IdentifiedUser caller)
|
||||
throws MergeValidationException {
|
||||
mergeValidationListeners.runEach(
|
||||
l -> l.onPreMerge(repo, commit, destProject, destBranch, patchSetId, caller),
|
||||
l -> l.onPreMerge(repo, commit, destProject, destBranch, changeId, patchSetId, caller),
|
||||
MergeValidationException.class);
|
||||
}
|
||||
}
|
||||
@@ -288,6 +292,7 @@ public class MergeValidators {
|
||||
CodeReviewCommit commit,
|
||||
ProjectState destProject,
|
||||
Branch.NameKey destBranch,
|
||||
Change.Id changeId,
|
||||
PatchSet.Id patchSetId,
|
||||
IdentifiedUser caller)
|
||||
throws MergeValidationException {
|
||||
@@ -339,6 +344,7 @@ public class MergeValidators {
|
||||
CodeReviewCommit commit,
|
||||
ProjectState destProject,
|
||||
Branch.NameKey destBranch,
|
||||
Change.Id changeId,
|
||||
PatchSet.Id patchSetId,
|
||||
IdentifiedUser caller)
|
||||
throws MergeValidationException {
|
||||
|
@@ -846,7 +846,7 @@ public class MergeOp implements AutoCloseable {
|
||||
MergeValidators mergeValidators = mergeValidatorsFactory.create();
|
||||
try {
|
||||
mergeValidators.validatePreMerge(
|
||||
or.repo, commit, or.project, destBranch, ps.getId(), caller);
|
||||
or.repo, commit, or.project, destBranch, changeId, ps.getId(), caller);
|
||||
} catch (MergeValidationException mve) {
|
||||
commitStatus.problem(changeId, mve.getMessage());
|
||||
continue;
|
||||
|
Submodule plugins/hooks updated: d2632b5727...c0f9d23820
Reference in New Issue
Block a user