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
ConstructorDescriptionCommitsCollection
(DynamicMap<RestView<CommitResource>> views, GitRepositoryManager repoManager, RetryHelper retryHelper, ChangeIndexCollection indexes, Reachable reachable) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canRead
(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit) Returns true ifcommit
is visible to the caller.boolean
canRead
(ProjectState state, org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevCommit commit, org.eclipse.jgit.lib.Ref ref) Returns true ifcommit
is visible to the caller andcommit
is 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:RestCollection
Create 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:
list
in 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:RestCollection
Parse a path component into a resource handle.- Specified by:
parse
in interfaceRestCollection<ProjectResource,
CommitResource> - Parameters:
parent
- the handle to the collection.id
- string identifier supplied by the client. In a URL such as/changes/1234/abandon
this string is"1234"
.- Returns:
- a resource handle for the identified object.
- Throws:
RestApiException
IOException
-
views
Description copied from interface:RestCollection
Get the views that support this collection.Within a resource the views are accessed as
RESOURCE/plugin~view
.- Specified by:
views
in 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 ifcommit
is visible to the caller andcommit
is 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 ifcommit
is visible to the caller.- Throws:
IOException
-