Search in sources :

Example 6 with ProjectResource

use of com.google.gerrit.server.project.ProjectResource in project gerrit by GerritCodeReview.

the class BanCommitCommand method run.

@Override
protected void run() throws Failure {
    try {
        BanCommit.Input input = BanCommit.Input.fromCommits(Lists.transform(commitsToBan, ObjectId::getName));
        input.reason = reason;
        BanResultInfo r = banCommit.apply(new ProjectResource(projectControl), input);
        printCommits(r.newlyBanned, "The following commits were banned");
        printCommits(r.alreadyBanned, "The following commits were already banned");
        printCommits(r.ignored, "The following ids do not represent commits and were ignored");
    } catch (RestApiException | IOException e) {
        throw die(e);
    }
}
Also used : BanResultInfo(com.google.gerrit.server.project.BanCommit.BanResultInfo) ProjectResource(com.google.gerrit.server.project.ProjectResource) IOException(java.io.IOException) RestApiException(com.google.gerrit.extensions.restapi.RestApiException) BanCommit(com.google.gerrit.server.project.BanCommit)

Aggregations

ProjectResource (com.google.gerrit.server.project.ProjectResource)6 Project (com.google.gerrit.reviewdb.client.Project)3 ProjectInfo (com.google.gerrit.extensions.common.ProjectInfo)2 RestApiException (com.google.gerrit.extensions.restapi.RestApiException)2 UnprocessableEntityException (com.google.gerrit.extensions.restapi.UnprocessableEntityException)2 ArrayList (java.util.ArrayList)2 Capable (com.google.gerrit.common.data.Capable)1 ConfigInput (com.google.gerrit.extensions.api.projects.ConfigInput)1 GeneralPreferencesInfo (com.google.gerrit.extensions.client.GeneralPreferencesInfo)1 AuthException (com.google.gerrit.extensions.restapi.AuthException)1 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)1 MethodNotAllowedException (com.google.gerrit.extensions.restapi.MethodNotAllowedException)1 ResourceConflictException (com.google.gerrit.extensions.restapi.ResourceConflictException)1 Change (com.google.gerrit.reviewdb.client.Change)1 PatchSet (com.google.gerrit.reviewdb.client.PatchSet)1 GerritPersonIdent (com.google.gerrit.server.GerritPersonIdent)1 IdentifiedUser (com.google.gerrit.server.IdentifiedUser)1 AccountState (com.google.gerrit.server.account.AccountState)1 PermissionBackendException (com.google.gerrit.server.permissions.PermissionBackendException)1 BanCommit (com.google.gerrit.server.project.BanCommit)1