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:
David Pursehouse
2019-11-13 00:35:05 -08:00
parent 6bd0701842
commit 85324e5db6
4 changed files with 4 additions and 13 deletions

View File

@@ -16,7 +16,6 @@ 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;
@@ -37,7 +36,6 @@ public interface MergeValidationListener {
* @param commit commit details
* @param destProject the destination project
* @param destBranch the destination branch
* @param changeId the change ID
* @param patchSetId the patch set ID
* @param caller the user who initiated the merge request
* @throws MergeValidationException if the commit fails to validate
@@ -47,7 +45,6 @@ public interface MergeValidationListener {
CodeReviewCommit commit,
ProjectState destProject,
Branch.NameKey destBranch,
Change.Id changeId,
PatchSet.Id patchSetId,
IdentifiedUser caller)
throws MergeValidationException;

View File

@@ -23,7 +23,6 @@ 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;
@@ -84,7 +83,6 @@ public class MergeValidators {
CodeReviewCommit commit,
ProjectState destProject,
Branch.NameKey destBranch,
Change.Id changeId,
PatchSet.Id patchSetId,
IdentifiedUser caller)
throws MergeValidationException {
@@ -96,7 +94,7 @@ public class MergeValidators {
groupValidatorFactory.create());
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 ProjectState destProject,
final Branch.NameKey destBranch,
final Change.Id changeId,
final PatchSet.Id patchSetId,
IdentifiedUser caller)
throws MergeValidationException {
@@ -254,12 +251,11 @@ 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, changeId, patchSetId, caller),
l -> l.onPreMerge(repo, commit, destProject, destBranch, patchSetId, caller),
MergeValidationException.class);
}
}
@@ -292,7 +288,6 @@ public class MergeValidators {
CodeReviewCommit commit,
ProjectState destProject,
Branch.NameKey destBranch,
Change.Id changeId,
PatchSet.Id patchSetId,
IdentifiedUser caller)
throws MergeValidationException {
@@ -344,7 +339,6 @@ public class MergeValidators {
CodeReviewCommit commit,
ProjectState destProject,
Branch.NameKey destBranch,
Change.Id changeId,
PatchSet.Id patchSetId,
IdentifiedUser caller)
throws MergeValidationException {

View File

@@ -846,7 +846,7 @@ public class MergeOp implements AutoCloseable {
MergeValidators mergeValidators = mergeValidatorsFactory.create();
try {
mergeValidators.validatePreMerge(
or.repo, commit, or.project, destBranch, changeId, ps.getId(), caller);
or.repo, commit, or.project, destBranch, ps.getId(), caller);
} catch (MergeValidationException mve) {
commitStatus.problem(changeId, mve.getMessage());
continue;