Merge branch 'stable-2.16' into stable-3.0
* stable-2.16: Avoid browser caching for diff on edit patch MergeValidationListener: Include the change Id in onPreMerge Upgrade jackson-core to 2.10.1 Change-Id: I1eb449cda2fa0d95029271f29a7b5c0e161edb97
This commit is contained in:
@@ -1053,8 +1053,8 @@ maven_jar(
|
|||||||
|
|
||||||
maven_jar(
|
maven_jar(
|
||||||
name = "jackson-core",
|
name = "jackson-core",
|
||||||
artifact = "com.fasterxml.jackson.core:jackson-core:2.10.0",
|
artifact = "com.fasterxml.jackson.core:jackson-core:2.10.1",
|
||||||
sha1 = "4e2c5fa04648ec9772c63e2101c53af6504e624e",
|
sha1 = "2c8b5e26ba40e5f91eb37a24075a2028b402c5f9",
|
||||||
)
|
)
|
||||||
|
|
||||||
TESTCONTAINERS_VERSION = "1.12.3"
|
TESTCONTAINERS_VERSION = "1.12.3"
|
||||||
|
@@ -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;
|
||||||
|
@@ -24,6 +24,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;
|
||||||
@@ -81,6 +82,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 {
|
||||||
@@ -92,7 +94,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,6 +159,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 {
|
||||||
@@ -252,11 +255,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,6 +290,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 {
|
||||||
@@ -337,6 +342,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 {
|
||||||
|
@@ -836,7 +836,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: 374f6142be...df7cf871ac
@@ -2280,15 +2280,23 @@
|
|||||||
params.base = basePatchNum;
|
params.base = basePatchNum;
|
||||||
}
|
}
|
||||||
const endpoint = `/files/${encodeURIComponent(path)}/diff`;
|
const endpoint = `/files/${encodeURIComponent(path)}/diff`;
|
||||||
|
const req = {
|
||||||
return this._getChangeURLAndFetch({
|
|
||||||
changeNum,
|
changeNum,
|
||||||
endpoint,
|
endpoint,
|
||||||
patchNum,
|
patchNum,
|
||||||
errFn: opt_errFn,
|
errFn: opt_errFn,
|
||||||
params,
|
params,
|
||||||
anonymizedEndpoint: '/files/*/diff',
|
anonymizedEndpoint: '/files/*/diff',
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// Invalidate the cache if its edit patch to make sure we always get latest.
|
||||||
|
if (patchNum === this.EDIT_NAME) {
|
||||||
|
if (!req.fetchOptions) req.fetchOptions = {};
|
||||||
|
if (!req.fetchOptions.headers) req.fetchOptions.headers = new Headers();
|
||||||
|
req.fetchOptions.headers.append('Cache-Control', 'no-cache');
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._getChangeURLAndFetch(req);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user