use of com.google.gerrit.server.project.ProjectResource in project gerrit by GerritCodeReview.
the class ChildProjectsCollection method parse.
@Override
public ChildProjectResource parse(ProjectResource parent, IdString id) throws RestApiException, IOException, PermissionBackendException {
parent.getProjectState().checkStatePermitsRead();
ProjectResource p = projectsCollection.parse(TopLevelResource.INSTANCE, id);
for (ProjectState pp : p.getProjectState().parents()) {
if (parent.getNameKey().equals(pp.getProject().getNameKey())) {
return new ChildProjectResource(parent, p.getProjectState());
}
}
throw new ResourceNotFoundException(id);
}
use of com.google.gerrit.server.project.ProjectResource in project gerrit by GerritCodeReview.
the class BanCommitCommand method run.
@Override
protected void run() throws Failure {
enableGracefulStop();
try {
BanCommitInput input = BanCommitInput.fromCommits(Lists.transform(commitsToBan, ObjectId::getName));
input.reason = reason;
BanResultInfo r = banCommit.apply(new ProjectResource(projectState, user), input).value();
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 (Exception e) {
throw die(e);
}
}
Aggregations