use of com.google.gerrit.server.git.IntegrationException in project gerrit by GerritCodeReview.
the class SubmitStrategyOp method checkProjectConfig.
private void checkProjectConfig(RepoContext ctx, CodeReviewCommit commit) throws IntegrationException {
String refName = getDest().get();
if (RefNames.REFS_CONFIG.equals(refName)) {
logDebug("Loading new configuration from {}", RefNames.REFS_CONFIG);
try {
ProjectConfig cfg = new ProjectConfig(getProject());
cfg.load(ctx.getRevWalk(), commit);
} catch (Exception e) {
throw new IntegrationException("Submit would store invalid" + " project configuration " + commit.name() + " for " + getProject(), e);
}
}
}
use of com.google.gerrit.server.git.IntegrationException in project gerrit by GerritCodeReview.
the class RebaseSubmitStrategy method buildOps.
@Override
public List<SubmitStrategyOp> buildOps(Collection<CodeReviewCommit> toMerge) throws IntegrationException {
List<CodeReviewCommit> sorted;
try {
sorted = args.rebaseSorter.sort(toMerge);
} catch (IOException e) {
throw new IntegrationException("Commit sorting failed", e);
}
List<SubmitStrategyOp> ops = new ArrayList<>(sorted.size());
boolean first = true;
for (CodeReviewCommit c : sorted) {
if (c.getParentCount() > 1) {
// Since there is a merge commit, sort and prune again using
// MERGE_IF_NECESSARY semantics to avoid creating duplicate
// commits.
//
sorted = args.mergeUtil.reduceToMinimalMerge(args.mergeSorter, sorted);
break;
}
}
while (!sorted.isEmpty()) {
CodeReviewCommit n = sorted.remove(0);
if (first && args.mergeTip.getInitialTip() == null) {
// TODO(tandrii): Cherry-Pick strategy does this too, but it's wrong
// and can be fixed.
ops.add(new FastForwardOp(args, n));
} else if (n.getParentCount() == 0) {
ops.add(new RebaseRootOp(n));
} else if (n.getParentCount() == 1) {
ops.add(new RebaseOneOp(n));
} else {
ops.add(new RebaseMultipleParentsOp(n));
}
first = false;
}
return ops;
}
use of com.google.gerrit.server.git.IntegrationException in project gerrit by GerritCodeReview.
the class SubmitStrategyListener method afterUpdateRepos.
@Override
public void afterUpdateRepos() throws ResourceConflictException {
try {
markCleanMerges();
List<Change.Id> alreadyMerged = checkCommitStatus();
findUnmergedChanges(alreadyMerged);
} catch (IntegrationException e) {
throw new ResourceConflictException(e.getMessage(), e);
}
}
Aggregations