Search in sources :

Example 1 with HeadInput

use of com.google.gerrit.extensions.api.projects.HeadInput in project gerrit by GerritCodeReview.

the class SetHeadCommand method run.

@Override
protected void run() throws Exception {
    enableGracefulStop();
    HeadInput input = new HeadInput();
    input.ref = newHead;
    try {
        setHead.apply(new ProjectResource(project, user), input);
    } catch (UnprocessableEntityException e) {
        throw die(e);
    }
}
Also used : UnprocessableEntityException(com.google.gerrit.extensions.restapi.UnprocessableEntityException) HeadInput(com.google.gerrit.extensions.api.projects.HeadInput) ProjectResource(com.google.gerrit.server.project.ProjectResource)

Example 2 with HeadInput

use of com.google.gerrit.extensions.api.projects.HeadInput in project gerrit by GerritCodeReview.

the class ProjectApiImpl method head.

@Override
public void head(String head) throws RestApiException {
    HeadInput input = new HeadInput();
    input.ref = head;
    try {
        setHead.apply(checkExists(), input);
    } catch (Exception e) {
        throw asRestApiException("Cannot set HEAD", e);
    }
}
Also used : HeadInput(com.google.gerrit.extensions.api.projects.HeadInput) ResourceNotFoundException(com.google.gerrit.extensions.restapi.ResourceNotFoundException) ApiUtil.asRestApiException(com.google.gerrit.server.api.ApiUtil.asRestApiException) BadRequestException(com.google.gerrit.extensions.restapi.BadRequestException) NotImplementedException(com.google.gerrit.extensions.restapi.NotImplementedException) RestApiException(com.google.gerrit.extensions.restapi.RestApiException) ResourceConflictException(com.google.gerrit.extensions.restapi.ResourceConflictException)

Aggregations

HeadInput (com.google.gerrit.extensions.api.projects.HeadInput)2 BadRequestException (com.google.gerrit.extensions.restapi.BadRequestException)1 NotImplementedException (com.google.gerrit.extensions.restapi.NotImplementedException)1 ResourceConflictException (com.google.gerrit.extensions.restapi.ResourceConflictException)1 ResourceNotFoundException (com.google.gerrit.extensions.restapi.ResourceNotFoundException)1 RestApiException (com.google.gerrit.extensions.restapi.RestApiException)1 UnprocessableEntityException (com.google.gerrit.extensions.restapi.UnprocessableEntityException)1 ApiUtil.asRestApiException (com.google.gerrit.server.api.ApiUtil.asRestApiException)1 ProjectResource (com.google.gerrit.server.project.ProjectResource)1