Merge branch 'stable-2.16' into stable-3.0
* stable-2.16: Set version to 2.15.16-SNAPSHOT Fix ls-user-ref and use the correct identity for listing refs Set version to 2.15.15 ReceiveCommits: Fix comparison to ensure correct log message Set sshd.threads to at least 4. Add assertThrows method compatible with future JUnit 4.13 ReceiveCommits: Bypass commit count when skip-validation is used Update git submodules Update git submodules Update git submodules Update git submodules Update git submodules Update git submodules Update git submodules change-merged: set correct newRev on submit by push Change-Id: I481b3cb4d4998b7d387262ab523c53407f5841b5
This commit is contained in:
@@ -112,7 +112,8 @@ patchSet:: link:json.html#patchSet[patchSet attribute]
|
|||||||
|
|
||||||
submitter:: link:json.html#account[account attribute]
|
submitter:: link:json.html#account[account attribute]
|
||||||
|
|
||||||
newRev:: The resulting revision of the merge.
|
newRev:: The state (revision) of the target branch after the operation that
|
||||||
|
closed the change was completed.
|
||||||
|
|
||||||
eventCreatedOn:: Time in seconds since the UNIX epoch when this event was
|
eventCreatedOn:: Time in seconds since the UNIX epoch when this event was
|
||||||
created.
|
created.
|
||||||
|
|||||||
@@ -4254,7 +4254,8 @@ Number of threads to use when executing SSH command requests.
|
|||||||
If additional requests are received while all threads are busy they
|
If additional requests are received while all threads are busy they
|
||||||
are queued and serviced in a first-come-first-served order.
|
are queued and serviced in a first-come-first-served order.
|
||||||
+
|
+
|
||||||
By default, 2x the number of CPUs available to the JVM.
|
By default, 2x the number of CPUs available to the JVM (but at least 4
|
||||||
|
threads).
|
||||||
+
|
+
|
||||||
[NOTE]
|
[NOTE]
|
||||||
When SSH daemon is enabled then this setting also defines the max number of
|
When SSH daemon is enabled then this setting also defines the max number of
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ package com.google.gerrit.acceptance;
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.LinkedListMultimap;
|
import com.google.common.collect.LinkedListMultimap;
|
||||||
@@ -109,7 +110,8 @@ public class EventRecorder {
|
|||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImmutableList<ChangeMergedEvent> getChangeMergedEvents(
|
@VisibleForTesting
|
||||||
|
public ImmutableList<ChangeMergedEvent> getChangeMergedEvents(
|
||||||
String project, String branch, int expectedSize) {
|
String project, String branch, int expectedSize) {
|
||||||
String key = refEventKey(ChangeMergedEvent.TYPE, project, branch);
|
String key = refEventKey(ChangeMergedEvent.TYPE, project, branch);
|
||||||
if (expectedSize == 0) {
|
if (expectedSize == 0) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class ThreadSettingsConfig {
|
|||||||
@Inject
|
@Inject
|
||||||
ThreadSettingsConfig(@GerritServerConfig Config cfg) {
|
ThreadSettingsConfig(@GerritServerConfig Config cfg) {
|
||||||
int cores = Runtime.getRuntime().availableProcessors();
|
int cores = Runtime.getRuntime().availableProcessors();
|
||||||
sshdThreads = cfg.getInt("sshd", "threads", 2 * cores);
|
sshdThreads = cfg.getInt("sshd", "threads", Math.max(4, 2 * cores));
|
||||||
httpdMaxThreads = cfg.getInt("httpd", "maxThreads", 25);
|
httpdMaxThreads = cfg.getInt("httpd", "maxThreads", 25);
|
||||||
int defaultDatabasePoolLimit = sshdThreads + httpdMaxThreads + 2;
|
int defaultDatabasePoolLimit = sshdThreads + httpdMaxThreads + 2;
|
||||||
databasePoolLimit = cfg.getInt("database", "poolLimit", defaultDatabasePoolLimit);
|
databasePoolLimit = cfg.getInt("database", "poolLimit", defaultDatabasePoolLimit);
|
||||||
|
|||||||
@@ -52,7 +52,10 @@ public class MergedByPushOp implements BatchUpdateOp {
|
|||||||
|
|
||||||
public interface Factory {
|
public interface Factory {
|
||||||
MergedByPushOp create(
|
MergedByPushOp create(
|
||||||
RequestScopePropagator requestScopePropagator, PatchSet.Id psId, String refName);
|
RequestScopePropagator requestScopePropagator,
|
||||||
|
PatchSet.Id psId,
|
||||||
|
@Assisted("refName") String refName,
|
||||||
|
@Assisted("mergeResultRevId") String mergeResultRevId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final RequestScopePropagator requestScopePropagator;
|
private final RequestScopePropagator requestScopePropagator;
|
||||||
@@ -65,6 +68,7 @@ public class MergedByPushOp implements BatchUpdateOp {
|
|||||||
|
|
||||||
private final PatchSet.Id psId;
|
private final PatchSet.Id psId;
|
||||||
private final String refName;
|
private final String refName;
|
||||||
|
private final String mergeResultRevId;
|
||||||
|
|
||||||
private Change change;
|
private Change change;
|
||||||
private boolean correctBranch;
|
private boolean correctBranch;
|
||||||
@@ -82,7 +86,8 @@ public class MergedByPushOp implements BatchUpdateOp {
|
|||||||
ChangeMerged changeMerged,
|
ChangeMerged changeMerged,
|
||||||
@Assisted RequestScopePropagator requestScopePropagator,
|
@Assisted RequestScopePropagator requestScopePropagator,
|
||||||
@Assisted PatchSet.Id psId,
|
@Assisted PatchSet.Id psId,
|
||||||
@Assisted String refName) {
|
@Assisted("refName") String refName,
|
||||||
|
@Assisted("mergeResultRevId") String mergeResultRevId) {
|
||||||
this.patchSetInfoFactory = patchSetInfoFactory;
|
this.patchSetInfoFactory = patchSetInfoFactory;
|
||||||
this.cmUtil = cmUtil;
|
this.cmUtil = cmUtil;
|
||||||
this.mergedSenderFactory = mergedSenderFactory;
|
this.mergedSenderFactory = mergedSenderFactory;
|
||||||
@@ -92,6 +97,7 @@ public class MergedByPushOp implements BatchUpdateOp {
|
|||||||
this.requestScopePropagator = requestScopePropagator;
|
this.requestScopePropagator = requestScopePropagator;
|
||||||
this.psId = psId;
|
this.psId = psId;
|
||||||
this.refName = refName;
|
this.refName = refName;
|
||||||
|
this.mergeResultRevId = mergeResultRevId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMergedIntoRef() {
|
public String getMergedIntoRef() {
|
||||||
@@ -192,8 +198,7 @@ public class MergedByPushOp implements BatchUpdateOp {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
changeMerged.fire(
|
changeMerged.fire(change, patchSet, ctx.getAccount(), mergeResultRevId, ctx.getWhen());
|
||||||
change, patchSet, ctx.getAccount(), patchSet.getRevision().get(), ctx.getWhen());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private PatchSetInfo getPatchSetInfo(ChangeContext ctx) throws IOException {
|
private PatchSetInfo getPatchSetInfo(ChangeContext ctx) throws IOException {
|
||||||
|
|||||||
@@ -2869,6 +2869,7 @@ class ReceiveCommits {
|
|||||||
projectState,
|
projectState,
|
||||||
notes.getChange().getDest(),
|
notes.getChange().getDest(),
|
||||||
checkMergedInto,
|
checkMergedInto,
|
||||||
|
checkMergedInto ? inputCommand.getNewId().name() : null,
|
||||||
priorPatchSet,
|
priorPatchSet,
|
||||||
priorCommit,
|
priorCommit,
|
||||||
psId,
|
psId,
|
||||||
@@ -3099,6 +3100,9 @@ class ReceiveCommits {
|
|||||||
int limit = receiveConfig.maxBatchCommits;
|
int limit = receiveConfig.maxBatchCommits;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (RevCommit c; (c = walk.next()) != null; ) {
|
for (RevCommit c; (c = walk.next()) != null; ) {
|
||||||
|
// Even if skipValidation is set, we still get here when at least one plugin
|
||||||
|
// commit validator requires to validate all commits. In this case, however,
|
||||||
|
// we don't need to check the commit limit.
|
||||||
if (++n > limit && !skipValidation) {
|
if (++n > limit && !skipValidation) {
|
||||||
logger.atFine().log("Number of new commits exceeds limit of %d", limit);
|
logger.atFine().log("Number of new commits exceeds limit of %d", limit);
|
||||||
reject(
|
reject(
|
||||||
@@ -3169,7 +3173,8 @@ class ReceiveCommits {
|
|||||||
bu.addOp(notes.get().getChangeId(), setPrivateOpFactory.create(false, null));
|
bu.addOp(notes.get().getChangeId(), setPrivateOpFactory.create(false, null));
|
||||||
bu.addOp(
|
bu.addOp(
|
||||||
psId.getParentKey(),
|
psId.getParentKey(),
|
||||||
mergedByPushOpFactory.create(requestScopePropagator, psId, refName));
|
mergedByPushOpFactory.create(
|
||||||
|
requestScopePropagator, psId, refName, newTip.getId().getName()));
|
||||||
continue COMMIT;
|
continue COMMIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3203,7 +3208,7 @@ class ReceiveCommits {
|
|||||||
bu.addOp(
|
bu.addOp(
|
||||||
id,
|
id,
|
||||||
mergedByPushOpFactory
|
mergedByPushOpFactory
|
||||||
.create(requestScopePropagator, req.psId, refName)
|
.create(requestScopePropagator, req.psId, refName, newTip.getId().getName())
|
||||||
.setPatchSetProvider(req.replaceOp::getPatchSet));
|
.setPatchSetProvider(req.replaceOp::getPatchSet));
|
||||||
bu.addOp(id, new ChangeProgressOp(progress));
|
bu.addOp(id, new ChangeProgressOp(progress));
|
||||||
ids.add(id);
|
ids.add(id);
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public class ReplaceOp implements BatchUpdateOp {
|
|||||||
ProjectState projectState,
|
ProjectState projectState,
|
||||||
Branch.NameKey dest,
|
Branch.NameKey dest,
|
||||||
boolean checkMergedInto,
|
boolean checkMergedInto,
|
||||||
|
@Nullable String mergeResultRevId,
|
||||||
@Assisted("priorPatchSetId") PatchSet.Id priorPatchSetId,
|
@Assisted("priorPatchSetId") PatchSet.Id priorPatchSetId,
|
||||||
@Assisted("priorCommitId") ObjectId priorCommit,
|
@Assisted("priorCommitId") ObjectId priorCommit,
|
||||||
@Assisted("patchSetId") PatchSet.Id patchSetId,
|
@Assisted("patchSetId") PatchSet.Id patchSetId,
|
||||||
@@ -133,6 +134,7 @@ public class ReplaceOp implements BatchUpdateOp {
|
|||||||
private final ProjectState projectState;
|
private final ProjectState projectState;
|
||||||
private final Branch.NameKey dest;
|
private final Branch.NameKey dest;
|
||||||
private final boolean checkMergedInto;
|
private final boolean checkMergedInto;
|
||||||
|
private final String mergeResultRevId;
|
||||||
private final PatchSet.Id priorPatchSetId;
|
private final PatchSet.Id priorPatchSetId;
|
||||||
private final ObjectId priorCommitId;
|
private final ObjectId priorCommitId;
|
||||||
private final PatchSet.Id patchSetId;
|
private final PatchSet.Id patchSetId;
|
||||||
@@ -177,6 +179,7 @@ public class ReplaceOp implements BatchUpdateOp {
|
|||||||
@Assisted ProjectState projectState,
|
@Assisted ProjectState projectState,
|
||||||
@Assisted Branch.NameKey dest,
|
@Assisted Branch.NameKey dest,
|
||||||
@Assisted boolean checkMergedInto,
|
@Assisted boolean checkMergedInto,
|
||||||
|
@Assisted @Nullable String mergeResultRevId,
|
||||||
@Assisted("priorPatchSetId") PatchSet.Id priorPatchSetId,
|
@Assisted("priorPatchSetId") PatchSet.Id priorPatchSetId,
|
||||||
@Assisted("priorCommitId") ObjectId priorCommitId,
|
@Assisted("priorCommitId") ObjectId priorCommitId,
|
||||||
@Assisted("patchSetId") PatchSet.Id patchSetId,
|
@Assisted("patchSetId") PatchSet.Id patchSetId,
|
||||||
@@ -205,6 +208,7 @@ public class ReplaceOp implements BatchUpdateOp {
|
|||||||
this.projectState = projectState;
|
this.projectState = projectState;
|
||||||
this.dest = dest;
|
this.dest = dest;
|
||||||
this.checkMergedInto = checkMergedInto;
|
this.checkMergedInto = checkMergedInto;
|
||||||
|
this.mergeResultRevId = mergeResultRevId;
|
||||||
this.priorPatchSetId = priorPatchSetId;
|
this.priorPatchSetId = priorPatchSetId;
|
||||||
this.priorCommitId = priorCommitId.copy();
|
this.priorCommitId = priorCommitId.copy();
|
||||||
this.patchSetId = patchSetId;
|
this.patchSetId = patchSetId;
|
||||||
@@ -231,7 +235,8 @@ public class ReplaceOp implements BatchUpdateOp {
|
|||||||
String mergedInto = findMergedInto(ctx, dest.get(), commit);
|
String mergedInto = findMergedInto(ctx, dest.get(), commit);
|
||||||
if (mergedInto != null) {
|
if (mergedInto != null) {
|
||||||
mergedByPushOp =
|
mergedByPushOp =
|
||||||
mergedByPushOpFactory.create(requestScopePropagator, patchSetId, mergedInto);
|
mergedByPushOpFactory.create(
|
||||||
|
requestScopePropagator, patchSetId, mergedInto, mergeResultRevId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class LsUserRefs extends SshCommand {
|
|||||||
try {
|
try {
|
||||||
Map<String, Ref> refsMap =
|
Map<String, Ref> refsMap =
|
||||||
permissionBackend
|
permissionBackend
|
||||||
.user(user)
|
.user(ctx.getUser())
|
||||||
.project(projectName)
|
.project(projectName)
|
||||||
.filter(repo.getRefDatabase().getRefs(), repo, RefFilterOptions.defaults());
|
.filter(repo.getRefDatabase().getRefs(), repo, RefFilterOptions.defaults());
|
||||||
|
|
||||||
|
|||||||
@@ -2277,6 +2277,34 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
|||||||
@GerritConfig(name = "receive.maxBatchCommits", value = "2")
|
@GerritConfig(name = "receive.maxBatchCommits", value = "2")
|
||||||
@Test
|
@Test
|
||||||
public void maxBatchCommits() throws Exception {
|
public void maxBatchCommits() throws Exception {
|
||||||
|
testMaxBatchCommits();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GerritConfig(name = "receive.maxBatchCommits", value = "2")
|
||||||
|
@Test
|
||||||
|
public void maxBatchCommitsWithDefaultValidator() throws Exception {
|
||||||
|
TestValidator validator = new TestValidator();
|
||||||
|
RegistrationHandle handle = commitValidators.add("test-validator", validator);
|
||||||
|
try {
|
||||||
|
testMaxBatchCommits();
|
||||||
|
} finally {
|
||||||
|
handle.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GerritConfig(name = "receive.maxBatchCommits", value = "2")
|
||||||
|
@Test
|
||||||
|
public void maxBatchCommitsWithValidateAllCommitsValidator() throws Exception {
|
||||||
|
TestValidator validator = new TestValidator(true);
|
||||||
|
RegistrationHandle handle = commitValidators.add("test-validator", validator);
|
||||||
|
try {
|
||||||
|
testMaxBatchCommits();
|
||||||
|
} finally {
|
||||||
|
handle.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testMaxBatchCommits() throws Exception {
|
||||||
List<RevCommit> commits = new ArrayList<>();
|
List<RevCommit> commits = new ArrayList<>();
|
||||||
commits.addAll(initChanges(2));
|
commits.addAll(initChanges(2));
|
||||||
String master = "refs/heads/master";
|
String master = "refs/heads/master";
|
||||||
|
|||||||
@@ -30,9 +30,11 @@ import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
|||||||
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;
|
||||||
import com.google.gerrit.server.ApprovalsUtil;
|
import com.google.gerrit.server.ApprovalsUtil;
|
||||||
|
import com.google.gerrit.server.events.ChangeMergedEvent;
|
||||||
import com.google.gerrit.server.notedb.ChangeNotes;
|
import com.google.gerrit.server.notedb.ChangeNotes;
|
||||||
import com.google.gerrit.server.query.change.ChangeData;
|
import com.google.gerrit.server.query.change.ChangeData;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import java.util.List;
|
||||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||||
import org.eclipse.jgit.api.errors.InvalidRemoteException;
|
import org.eclipse.jgit.api.errors.InvalidRemoteException;
|
||||||
import org.eclipse.jgit.api.errors.TransportException;
|
import org.eclipse.jgit.api.errors.TransportException;
|
||||||
@@ -167,6 +169,19 @@ public class SubmitOnPushIT extends AbstractDaemonTest {
|
|||||||
assertThat(cd.patchSet(psId).getRevision().get()).isEqualTo(c.name());
|
assertThat(cd.patchSet(psId).getRevision().get()).isEqualTo(c.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void correctNewRevOnMergeByPushToBranch() throws Exception {
|
||||||
|
grant(project, "refs/heads/master", Permission.PUSH);
|
||||||
|
push("refs/for/master", PushOneCommit.SUBJECT, "one.txt", "One");
|
||||||
|
PushOneCommit.Result r = push("refs/for/master", PushOneCommit.SUBJECT, "two.txt", "Two");
|
||||||
|
startEventRecorder();
|
||||||
|
git().push().setRefSpecs(new RefSpec(r.getCommit().name() + ":refs/heads/master")).call();
|
||||||
|
List<ChangeMergedEvent> changeMergedEvents =
|
||||||
|
eventRecorder.getChangeMergedEvents(project.get(), "refs/heads/master", 2);
|
||||||
|
assertThat(changeMergedEvents.get(0).newRev).isEqualTo(r.getPatchSet().getRevision().get());
|
||||||
|
assertThat(changeMergedEvents.get(1).newRev).isEqualTo(r.getPatchSet().getRevision().get());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void mergeOnPushToBranchWithChangeMergedInOther() throws Exception {
|
public void mergeOnPushToBranchWithChangeMergedInOther() throws Exception {
|
||||||
enableCreateNewChangeForAllNotInTarget();
|
enableCreateNewChangeForAllNotInTarget();
|
||||||
|
|||||||
Submodule plugins/replication updated: 49597f862d...6038386d7e
Reference in New Issue
Block a user