Class CommitsCollection
java.lang.Object
com.google.gerrit.server.restapi.project.CommitsCollection
- All Implemented Interfaces:
ChildCollection<ProjectResource,,CommitResource> RestCollection<ProjectResource,,CommitResource> RestView<ProjectResource>
public class CommitsCollection
extends Object
implements ChildCollection<ProjectResource,CommitResource>
The collection of commit IDs (ie. 40 char hex IDs)
-
Constructor Summary
ConstructorsConstructorDescriptionCommitsCollection(DynamicMap<RestView<CommitResource>> views, GitRepositoryManager repoManager, RetryHelper retryHelper, ChangeIndexCollection indexes, Reachable reachable) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRead(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit) Returns true ifcommitis visible to the caller.booleancanRead(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit, org.eclipse.jgit.lib.Ref ref) Returns true ifcommitis visible to the caller andcommitis reachable from the given branch.list()Create a view to list the contents of the collection.parse(ProjectResource parent, IdString id) Parse a path component into a resource handle.views()Get the views that support this collection.
-
Constructor Details
-
CommitsCollection
@Inject public CommitsCollection(DynamicMap<RestView<CommitResource>> views, GitRepositoryManager repoManager, RetryHelper retryHelper, ChangeIndexCollection indexes, Reachable reachable)
-
-
Method Details
-
list
Description copied from interface:RestCollectionCreate a view to list the contents of the collection.The returned view should accept the parent type to scope the search, and may want to take a "q" parameter option to narrow the results.
- Specified by:
listin interfaceRestCollection<ProjectResource,CommitResource> - Returns:
- view to list the collection.
- Throws:
ResourceNotFoundException- if the collection doesn't support listing.
-
parse
public CommitResource parse(ProjectResource parent, IdString id) throws RestApiException, IOException Description copied from interface:RestCollectionParse a path component into a resource handle.- Specified by:
parsein interfaceRestCollection<ProjectResource,CommitResource> - Parameters:
parent- the handle to the collection.id- string identifier supplied by the client. In a URL such as/changes/1234/abandonthis string is"1234".- Returns:
- a resource handle for the identified object.
- Throws:
RestApiExceptionIOException
-
views
Description copied from interface:RestCollectionGet the views that support this collection.Within a resource the views are accessed as
RESOURCE/plugin~view.- Specified by:
viewsin interfaceRestCollection<ProjectResource,CommitResource> - Returns:
- map of views.
-
canRead
public boolean canRead(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit, org.eclipse.jgit.lib.Ref ref) Returns true ifcommitis visible to the caller andcommitis reachable from the given branch. -
canRead
public boolean canRead(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit) throws IOException Returns true ifcommitis visible to the caller.- Throws:
IOException
-