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