Search in sources :

Example 6 with IntegrationException

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);
        }
    }
}
Also used : ProjectConfig(com.google.gerrit.server.git.ProjectConfig) IntegrationException(com.google.gerrit.server.git.IntegrationException) SubmoduleException(com.google.gerrit.server.git.SubmoduleException) OrmException(com.google.gwtorm.server.OrmException) MissingObjectException(org.eclipse.jgit.errors.MissingObjectException) IncorrectObjectTypeException(org.eclipse.jgit.errors.IncorrectObjectTypeException) IntegrationException(com.google.gerrit.server.git.IntegrationException) IOException(java.io.IOException)

Example 7 with IntegrationException

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;
}
Also used : IntegrationException(com.google.gerrit.server.git.IntegrationException) ArrayList(java.util.ArrayList) IOException(java.io.IOException) CodeReviewCommit(com.google.gerrit.server.git.CodeReviewCommit)

Example 8 with IntegrationException

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);
    }
}
Also used : ResourceConflictException(com.google.gerrit.extensions.restapi.ResourceConflictException) IntegrationException(com.google.gerrit.server.git.IntegrationException)

Aggregations

IntegrationException (com.google.gerrit.server.git.IntegrationException)8 Change (com.google.gerrit.reviewdb.client.Change)4 ResourceConflictException (com.google.gerrit.extensions.restapi.ResourceConflictException)3 CodeReviewCommit (com.google.gerrit.server.git.CodeReviewCommit)3 InvalidChangeOperationException (com.google.gerrit.server.project.InvalidChangeOperationException)3 Capable (com.google.gerrit.common.data.Capable)2 AuthException (com.google.gerrit.extensions.restapi.AuthException)2 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)2 CodeReviewRevWalk (com.google.gerrit.server.git.CodeReviewCommit.CodeReviewRevWalk)2 ChangeControl (com.google.gerrit.server.project.ChangeControl)2 ProjectControl (com.google.gerrit.server.project.ProjectControl)2 RefControl (com.google.gerrit.server.project.RefControl)2 OrmException (com.google.gwtorm.server.OrmException)2 IOException (java.io.IOException)2 ObjectId (org.eclipse.jgit.lib.ObjectId)2 Repository (org.eclipse.jgit.lib.Repository)2 SubmitTypeRecord (com.google.gerrit.common.data.SubmitTypeRecord)1 MergeConflictException (com.google.gerrit.extensions.restapi.MergeConflictException)1 Branch (com.google.gerrit.reviewdb.client.Branch)1 Project (com.google.gerrit.reviewdb.client.Project)1