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:
David Pursehouse
2019-07-26 11:44:02 +09:00
11 changed files with 75 additions and 13 deletions

View File

@@ -16,6 +16,7 @@ package com.google.gerrit.acceptance;
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.ImmutableList;
import com.google.common.collect.LinkedListMultimap;
@@ -109,7 +110,8 @@ public class EventRecorder {
return events;
}
private ImmutableList<ChangeMergedEvent> getChangeMergedEvents(
@VisibleForTesting
public ImmutableList<ChangeMergedEvent> getChangeMergedEvents(
String project, String branch, int expectedSize) {
String key = refEventKey(ChangeMergedEvent.TYPE, project, branch);
if (expectedSize == 0) {

View File

@@ -28,7 +28,7 @@ public class ThreadSettingsConfig {
@Inject
ThreadSettingsConfig(@GerritServerConfig Config cfg) {
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);
int defaultDatabasePoolLimit = sshdThreads + httpdMaxThreads + 2;
databasePoolLimit = cfg.getInt("database", "poolLimit", defaultDatabasePoolLimit);

View File

@@ -52,7 +52,10 @@ public class MergedByPushOp implements BatchUpdateOp {
public interface Factory {
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;
@@ -65,6 +68,7 @@ public class MergedByPushOp implements BatchUpdateOp {
private final PatchSet.Id psId;
private final String refName;
private final String mergeResultRevId;
private Change change;
private boolean correctBranch;
@@ -82,7 +86,8 @@ public class MergedByPushOp implements BatchUpdateOp {
ChangeMerged changeMerged,
@Assisted RequestScopePropagator requestScopePropagator,
@Assisted PatchSet.Id psId,
@Assisted String refName) {
@Assisted("refName") String refName,
@Assisted("mergeResultRevId") String mergeResultRevId) {
this.patchSetInfoFactory = patchSetInfoFactory;
this.cmUtil = cmUtil;
this.mergedSenderFactory = mergedSenderFactory;
@@ -92,6 +97,7 @@ public class MergedByPushOp implements BatchUpdateOp {
this.requestScopePropagator = requestScopePropagator;
this.psId = psId;
this.refName = refName;
this.mergeResultRevId = mergeResultRevId;
}
public String getMergedIntoRef() {
@@ -192,8 +198,7 @@ public class MergedByPushOp implements BatchUpdateOp {
}
}));
changeMerged.fire(
change, patchSet, ctx.getAccount(), patchSet.getRevision().get(), ctx.getWhen());
changeMerged.fire(change, patchSet, ctx.getAccount(), mergeResultRevId, ctx.getWhen());
}
private PatchSetInfo getPatchSetInfo(ChangeContext ctx) throws IOException {

View File

@@ -2869,6 +2869,7 @@ class ReceiveCommits {
projectState,
notes.getChange().getDest(),
checkMergedInto,
checkMergedInto ? inputCommand.getNewId().name() : null,
priorPatchSet,
priorCommit,
psId,
@@ -3099,6 +3100,9 @@ class ReceiveCommits {
int limit = receiveConfig.maxBatchCommits;
int n = 0;
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) {
logger.atFine().log("Number of new commits exceeds limit of %d", limit);
reject(
@@ -3169,7 +3173,8 @@ class ReceiveCommits {
bu.addOp(notes.get().getChangeId(), setPrivateOpFactory.create(false, null));
bu.addOp(
psId.getParentKey(),
mergedByPushOpFactory.create(requestScopePropagator, psId, refName));
mergedByPushOpFactory.create(
requestScopePropagator, psId, refName, newTip.getId().getName()));
continue COMMIT;
}
}
@@ -3203,7 +3208,7 @@ class ReceiveCommits {
bu.addOp(
id,
mergedByPushOpFactory
.create(requestScopePropagator, req.psId, refName)
.create(requestScopePropagator, req.psId, refName, newTip.getId().getName())
.setPatchSetProvider(req.replaceOp::getPatchSet));
bu.addOp(id, new ChangeProgressOp(progress));
ids.add(id);

View File

@@ -101,6 +101,7 @@ public class ReplaceOp implements BatchUpdateOp {
ProjectState projectState,
Branch.NameKey dest,
boolean checkMergedInto,
@Nullable String mergeResultRevId,
@Assisted("priorPatchSetId") PatchSet.Id priorPatchSetId,
@Assisted("priorCommitId") ObjectId priorCommit,
@Assisted("patchSetId") PatchSet.Id patchSetId,
@@ -133,6 +134,7 @@ public class ReplaceOp implements BatchUpdateOp {
private final ProjectState projectState;
private final Branch.NameKey dest;
private final boolean checkMergedInto;
private final String mergeResultRevId;
private final PatchSet.Id priorPatchSetId;
private final ObjectId priorCommitId;
private final PatchSet.Id patchSetId;
@@ -177,6 +179,7 @@ public class ReplaceOp implements BatchUpdateOp {
@Assisted ProjectState projectState,
@Assisted Branch.NameKey dest,
@Assisted boolean checkMergedInto,
@Assisted @Nullable String mergeResultRevId,
@Assisted("priorPatchSetId") PatchSet.Id priorPatchSetId,
@Assisted("priorCommitId") ObjectId priorCommitId,
@Assisted("patchSetId") PatchSet.Id patchSetId,
@@ -205,6 +208,7 @@ public class ReplaceOp implements BatchUpdateOp {
this.projectState = projectState;
this.dest = dest;
this.checkMergedInto = checkMergedInto;
this.mergeResultRevId = mergeResultRevId;
this.priorPatchSetId = priorPatchSetId;
this.priorCommitId = priorCommitId.copy();
this.patchSetId = patchSetId;
@@ -231,7 +235,8 @@ public class ReplaceOp implements BatchUpdateOp {
String mergedInto = findMergedInto(ctx, dest.get(), commit);
if (mergedInto != null) {
mergedByPushOp =
mergedByPushOpFactory.create(requestScopePropagator, patchSetId, mergedInto);
mergedByPushOpFactory.create(
requestScopePropagator, patchSetId, mergedInto, mergeResultRevId);
}
}

View File

@@ -91,7 +91,7 @@ public class LsUserRefs extends SshCommand {
try {
Map<String, Ref> refsMap =
permissionBackend
.user(user)
.user(ctx.getUser())
.project(projectName)
.filter(repo.getRefDatabase().getRefs(), repo, RefFilterOptions.defaults());