Merge changes Ib4128352,Ib6782160,I2c9d7259

* changes:
  SubmitStrategyListener: Add debug logs with commit status of all changes
  Move message for MISSING_DEPENDENCY into CommitMergeStatus enum
  MergeOp: Remove unused getProblems() method
This commit is contained in:
David Pursehouse
2018-10-02 23:20:33 +00:00
committed by Gerrit Code Review
4 changed files with 10 additions and 13 deletions

View File

@@ -40,7 +40,7 @@ public enum CommitMergeStatus {
SKIPPED_IDENTICAL_TREE(
"Marking change merged without cherry-picking to branch, as the resulting commit would be empty."),
MISSING_DEPENDENCY(""),
MISSING_DEPENDENCY("Depends on change that was not submitted."),
MANUAL_RECURSIVE_MERGE(
"The change requires a local merge to resolve.\n"

View File

@@ -24,7 +24,6 @@ import com.github.rholder.retry.Attempt;
import com.github.rholder.retry.RetryListener;
import com.google.auto.value.AutoValue;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSetMultimap;
@@ -174,10 +173,6 @@ public class MergeOp implements AutoCloseable {
return problems.isEmpty();
}
public ImmutableListMultimap<Change.Id, String> getProblems() {
return ImmutableListMultimap.copyOf(problems);
}
public List<SubmitRecord> getSubmitRecords(Change.Id id) {
// Use the cached submit records from the original ChangeData in the input
// ChangeSet, which were checked earlier in the integrate process. Even in

View File

@@ -16,6 +16,7 @@ package com.google.gerrit.server.submit;
import com.google.common.base.CharMatcher;
import com.google.common.collect.ImmutableSet;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.extensions.api.changes.SubmitInput;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.reviewdb.client.Change;
@@ -30,6 +31,8 @@ import java.util.Set;
import org.eclipse.jgit.revwalk.RevCommit;
public class SubmitStrategyListener implements BatchUpdateListener {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private final Collection<SubmitStrategy> strategies;
private final CommitStatus commitStatus;
private final boolean failAfterRefUpdates;
@@ -106,9 +109,11 @@ public class SubmitStrategyListener implements BatchUpdateListener {
CodeReviewCommit commit = commitStatus.get(id);
CommitMergeStatus s = commit != null ? commit.getStatusCode() : null;
if (s == null) {
logger.atSevere().log("change %d: change not processed by merge strategy", id.get());
commitStatus.problem(id, "internal error: change not processed by merge strategy");
continue;
}
logger.atFine().log("change %d: status for commit %s is %s", id.get(), commit.name(), s);
switch (s) {
case CLEAN_MERGE:
case CLEAN_REBASE:
@@ -128,15 +133,12 @@ public class SubmitStrategyListener implements BatchUpdateListener {
case CANNOT_REBASE_ROOT:
case NOT_FAST_FORWARD:
case EMPTY_COMMIT:
case MISSING_DEPENDENCY:
// TODO(dborowitz): Reformat these messages to be more appropriate for
// short problem descriptions.
commitStatus.problem(id, CharMatcher.is('\n').collapseFrom(s.getMessage(), ' '));
break;
case MISSING_DEPENDENCY:
commitStatus.problem(id, "depends on change that was not submitted");
break;
default:
commitStatus.problem(id, "unspecified merge failure: " + s);
break;

View File

@@ -402,8 +402,8 @@ public class SubmitByMergeIfNecessaryIT extends AbstractSubmitByMerge {
+ " due to the following problems:\n"
+ "Change "
+ change3a.getChange().getId()
+ ": depends on change that"
+ " was not submitted");
+ ": Depends on change that"
+ " was not submitted.");
RevCommit tipbranch = getRemoteLog(project, "branch").get(0);
assertThat(tipbranch.getShortMessage()).isEqualTo(change1.getCommit().getShortMessage());
@@ -501,7 +501,7 @@ public class SubmitByMergeIfNecessaryIT extends AbstractSubmitByMerge {
"Failed to submit 1 change due to the following problems:\n"
+ "Change "
+ change3.getPatchSetId().getParentKey().get()
+ ": depends on change that was not submitted");
+ ": Depends on change that was not submitted.");
assertRefUpdatedEvents();
assertChangeMergedEvents();