Revert "MergeValidationListener: Include the change Id in onPreMerge"
Rather than passing in the change Id, which is a breaking API change,
let the implementation get the change Id from the patch set Id.
This reverts commit 593a500705
.
Bug: Issue 11905
Change-Id: Ieba95cadcf7a4f60664120c59916ebce4a1caca4
This commit is contained in:
@@ -16,7 +16,6 @@ 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;
|
||||||
@@ -37,7 +36,6 @@ public interface MergeValidationListener {
|
|||||||
* @param commit commit details
|
* @param commit commit details
|
||||||
* @param destProject the destination project
|
* @param destProject the destination project
|
||||||
* @param destBranch the destination branch
|
* @param destBranch the destination branch
|
||||||
* @param changeId the change ID
|
|
||||||
* @param patchSetId the patch set ID
|
* @param patchSetId the patch set ID
|
||||||
* @param caller the user who initiated the merge request
|
* @param caller the user who initiated the merge request
|
||||||
* @throws MergeValidationException if the commit fails to validate
|
* @throws MergeValidationException if the commit fails to validate
|
||||||
@@ -47,7 +45,6 @@ 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,7 +23,6 @@ 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;
|
||||||
@@ -84,7 +83,6 @@ 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 {
|
||||||
@@ -96,7 +94,7 @@ public class MergeValidators {
|
|||||||
groupValidatorFactory.create());
|
groupValidatorFactory.create());
|
||||||
|
|
||||||
for (MergeValidationListener validator : validators) {
|
for (MergeValidationListener validator : validators) {
|
||||||
validator.onPreMerge(repo, commit, destProject, destBranch, changeId, patchSetId, caller);
|
validator.onPreMerge(repo, commit, destProject, destBranch, patchSetId, caller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +156,6 @@ 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 {
|
||||||
@@ -254,12 +251,11 @@ 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, changeId, patchSetId, caller),
|
l -> l.onPreMerge(repo, commit, destProject, destBranch, patchSetId, caller),
|
||||||
MergeValidationException.class);
|
MergeValidationException.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,7 +288,6 @@ 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 {
|
||||||
@@ -344,7 +339,6 @@ 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, changeId, ps.getId(), caller);
|
or.repo, commit, or.project, destBranch, 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: c0f9d23820...e9127800c4
Reference in New Issue
Block a user