public interface

CommitService

com.atlassian.stash.commit.CommitService

Summary

Public Methods
@Nonnull Comment addComment(Repository repository, String commitId, String commentText)
Adds a general comment on the specified commit in the specified repository.
@Nonnull Comment addDiffComment(Repository repository, String commitId, AddDiffCommentRequest request)
Adds a line comment to a commit diff in the specified repository.
@Nonnull Comment addFileComment(Repository repository, String commitId, AddFileCommentRequest request)
Adds a file-level comment to a commit diff in the specified repository.
@Nonnull Comment addReply(Repository repository, String commitId, long commentId, String commentText)
Adds a reply to a comment.
boolean deleteComment(Repository repository, String commitId, long commentId, int commentVersion)
Deletes a comment.
@Nonnull Iterable<DiffCommentAnchor> findCommentAnchors(Repository repository, String commitId, String parentId, String path)
Finds anchors for file and line comments on the specified path in the commit.
@Nonnull Page<Change> getChanges(ChangesRequest request, PageRequest pageRequest)
Retrieves a page of changes between two commits.
@Deprecated @Nonnull Changeset getChangeset(Repository repository, String changesetId, String path)
This method is deprecated. in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommit(CommitRequest) instead.
@Deprecated @Nonnull Changeset getChangeset(Repository repository, String changesetId, Collection<String> attributesToLoad)
This method is deprecated. in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommit(CommitRequest) instead.
@Deprecated @Nonnull Changeset getChangeset(Repository repository, String changesetId)
This method is deprecated. in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommit(CommitRequest) instead.
@Deprecated @Nonnull Changeset getChangeset(Repository repository, String changesetId, String path, Collection<String> attributesToLoad)
This method is deprecated. in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommit(CommitRequest) instead.
@Deprecated @Nonnull Page<Changeset> getChangesets(Repository repository, String changesetId, String path, Collection<String> attributesToLoad, PageRequest pageRequest)
This method is deprecated. in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommits(CommitsRequest, PageRequest) instead.
@Nonnull Page<Changeset> getChangesets(ChangesetsRequest request, PageRequest pageRequest)
Retrieves changesets for each of the requested getCommitIds() commits}, including the first page of changes between each commit and its first parent.
@Deprecated @Nonnull Page<Changeset> getChangesets(Repository repository, String changesetId, String path, PageRequest pageRequest)
This method is deprecated. in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommits(CommitsRequest, PageRequest) instead.
@Deprecated @Nonnull Page<Changeset> getChangesetsBetween(ChangesetsBetweenRequest request, PageRequest pageRequest)
This method is deprecated. in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommitsBetween(CommitsBetweenRequest, PageRequest) instead.
@Nonnull Comment getComment(Repository repository, String commitId, long commentId)
Retrieves a the specified comment by its ID.
@Nonnull Commit getCommit(CommitRequest request)
Retrieves a commit based on te provided request.
@Nonnull Page<Commit> getCommits(CommitsRequest request, PageRequest pageRequest)
Retrieves a page of commits, starting from a given branch, tag or commit, optionally filtered to only return commits which modify one or more paths.
@Nonnull Page<Commit> getCommitsBetween(CommitsBetweenRequest request, PageRequest pageRequest)
Retrieves a page of commits between the included commits and the excluded commits.
@Deprecated @Nonnull Page<DetailedChangeset> getDetailedChangesets(DetailedChangesetsRequest request, PageRequest pageRequest)
This method is deprecated. in 3.7 for removal in 4.0. With the removal of Changeset in 4.0, DetailedChangeset can be renamed to what it really is: Changeset. The "Detailed" prefix was added purely because the real name, Changeset, was already being used to describe something else. Use getChangesets(ChangesetsRequest, PageRequest) instead.
void streamChanges(ChangesRequest request, ChangeCallback callback)
Streams changes between the until and since changesets.
@Deprecated void streamChangesetsBetween(ChangesetsBetweenRequest request, ChangesetCallback callback)
This method is deprecated. in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use streamCommitsBetween(CommitsBetweenRequest, CommitCallback) instead.
void streamCommits(CommitsRequest request, CommitCallback callback)
Streams commits, starting from a given branch, tag or commit, optionally filtered to only include commits which modify one or more paths.
void streamCommitsBetween(CommitsBetweenRequest request, CommitCallback callback)
Streams commits between the included commits and the excluded commits.
void streamDiff(DiffRequest request, DiffContentCallback callback)
Streams diff output for the specified paths at the specified changeset.
void traverse(TraversalRequest request, TraversalCallback callback)
Traverse the graph of commits in topological order, optionally supplying included commits to start from and excluded commits to ignore.
boolean unwatch(Repository repository, String commitId)
Removes the current user as a watcher for the specified commit, which will prevent further notifications from being dispatched to that user.
@Nonnull Comment updateComment(Repository repository, String commitId, long commentId, int commentVersion, String commentText)
Updates the text for the specified comment.
@Nonnull Watcher watch(Repository repository, String commitId)
Adds the current user as a watcher for the specified commit.

Public Methods

@Nonnull public Comment addComment (Repository repository, String commitId, String commentText)

Adds a general comment on the specified commit in the specified repository.

Parameters
repository the ID of the repository containing the commit
commitId the ID of the commit within the repository
commentText the comment text
Returns
  • the created comment

@Nonnull public Comment addDiffComment (Repository repository, String commitId, AddDiffCommentRequest request)

Adds a line comment to a commit diff in the specified repository.

The request's toHash should generally be omitted. If it is provided, it must match the commitId. For merge commits, which have a diff for each parent, the desired diff can be selected by providing the parent's ID in the fromHash. If the fromHash is null, the first parent will be assumed.

Parameters
repository the ID of the repository containing the commit
commitId the ID of the commit within the repository
request a request describing the comment to create
Returns
  • the created line comment
Throws
ArgumentValidationException if the request contains invalid data

@Nonnull public Comment addFileComment (Repository repository, String commitId, AddFileCommentRequest request)

Adds a file-level comment to a commit diff in the specified repository.

The request's toHash should generally be omitted. If it is provided, it must match the commitId. For merge commits, which have a diff for each parent, the desired diff can be selected by providing the parent's ID in the fromHash. If the fromHash is null, the first parent will be assumed.

Parameters
repository the ID of the repository containing the commit
commitId the ID of the commit within the repository
request a request describing the comment to create
Returns
  • the created file comment
Throws
ArgumentValidationException if the request contains invalid data

@Nonnull public Comment addReply (Repository repository, String commitId, long commentId, String commentText)

Adds a reply to a comment.

Parameters
repository the ID of the repository containing the commit
commitId the ID of the commit within the repository
commentId the ID of the comment to reply to
commentText the comment text
Returns
  • the created comment
Throws
NoSuchCommentException if no comment exists with the specified ID

public boolean deleteComment (Repository repository, String commitId, long commentId, int commentVersion)

Deletes a comment.

Parameters
repository the ID of the repository containing the commit
commitId the ID of the commit within the repository
commentId the ID of the comment to delete
commentVersion the expected version of the comment
Returns
  • true if the comment existed (and thus was deleted); otherwise false
Throws
CommentDeletionException if the comment has replies
CommentOutOfDateException if the version of the specified comment does not match the expected version

@Nonnull public Iterable<DiffCommentAnchor> findCommentAnchors (Repository repository, String commitId, String parentId, String path)

Finds anchors for file and line comments on the specified path in the commit. For merge commits, which have a diff for each parent, the parent ID can also be provided to select the diff to retrieve comments from.

Parameters
repository the ID of the repository containing the commit
commitId the ID of the commit within the repository
parentId the ID of the parent, used to select the desired diff for merge commits. If the parent ID is not provided the commit's first parent is automatically used if it has one
path the path of the file for which the anchors should be retrieved
Returns
  • all anchors (representing comments) for the specified modified path in the commit

@Nonnull public Page<Change> getChanges (ChangesRequest request, PageRequest pageRequest)

Retrieves a page of changes between two commits. If the since commit is not specified, the until commit's first parent is used.

Note: The implementation will apply a hard cap (page.max.changes) and it is not possible to request subsequent content when that cap is exceeded.

Parameters
request describes the two commits to retrieve changes between and the repository which contains both commits
pageRequest the start and limit for the page being requested
Returns
  • a page of changes within the repository between the specified IDs

@Deprecated @Nonnull public Changeset getChangeset (Repository repository, String changesetId, String path)

This method is deprecated.
in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommit(CommitRequest) instead.

Retrieves the most recent changeset affecting the specified repository and path, starting from the changeset identified by changesetId, which may be a commit, branch or tag.

Parameters
repository the repository to find the changeset and path in
changesetId the starting changeset, which may be a specific commit or a branch or tag name
path the path to find the first changeset for
Returns
  • the first changeset affecting the specified path within the repository
Throws
NoSuchEntityException Thrown if no matching changeset can be found.

@Deprecated @Nonnull public Changeset getChangeset (Repository repository, String changesetId, Collection<String> attributesToLoad)

This method is deprecated.
in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommit(CommitRequest) instead.

Retrieves a changeset by its ID or the most recent changeset affecting a branch or tag. The specified attributesToLoad will also be loaded. These attributes are metadata associated with the changeset by a given ChangesetIndexer.

Parameters
repository the repository to find the changeset
changesetId the starting changeset, which may be a specific commit or a branch or tag name
Returns
  • the matching changeset within the repository
Throws
NoSuchEntityException Thrown if no matching changeset can be found.

@Deprecated @Nonnull public Changeset getChangeset (Repository repository, String changesetId)

This method is deprecated.
in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommit(CommitRequest) instead.

Retrieves a changeset by its ID or the most recent changeset affecting a branch or tag.

Parameters
repository the repository to find the changeset
changesetId the starting changeset, which may be a specific commit or a branch or tag name
Returns
  • the matching changeset within the repository
Throws
NoSuchEntityException Thrown if no matching changeset can be found.

@Deprecated @Nonnull public Changeset getChangeset (Repository repository, String changesetId, String path, Collection<String> attributesToLoad)

This method is deprecated.
in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommit(CommitRequest) instead.

Retrieves the most recent changeset affecting the specified repository and path, starting from the changeset identified by changesetId, which may be a commit, branch or tag. The specified attributesToLoad will also be loaded. These attributes are metadata associated with the changeset by a given ChangesetIndexer.

Parameters
repository the repository to find the changeset and path in
changesetId the starting changeset, which may be a specific commit or a branch or tag name
path the path to find the first changeset for
Returns
  • the first changeset affecting the specified path within the repository
Throws
NoSuchEntityException Thrown if no matching changeset can be found.

@Deprecated @Nonnull public Page<Changeset> getChangesets (Repository repository, String changesetId, String path, Collection<String> attributesToLoad, PageRequest pageRequest)

This method is deprecated.
in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommits(CommitsRequest, PageRequest) instead.

Retrieves a page of changesets for the provided path on the specified branch.

If the provided changesetId is null, the default branch for the repository will be assumed. If the path is null, changesets are returned starting from (and including) the provided changesetId (where, again, the repository's default branch will be used if null). As a result this service call may be used to:

  • Retrieve pages of changesets on a given branch or tag
  • Retrieve pages of ancestral changesets for a given changeset
  • Retrieve pages of changesets where a given file has be modified
Each usage is for a single starting point. This means a single branch, tag or changeset. For example, retrieving all changesets where a given file has been modified on all branches is not possible.

Note: If the provided path is renamed at some point in its history, changesets will not follow the path across the rename. In other words, only changesets for the exact path provided will be included.

Parameters
repository the repository to find the changesets and path in
changesetId the starting changeset from which to search for other changesets, which may be a branch or tag name or a changeset hash
path the path find changesets for
attributesToLoad Additional attributes to load
pageRequest the start and limit for the page being requested
Returns
  • a page of changes

@Nonnull public Page<Changeset> getChangesets (ChangesetsRequest request, PageRequest pageRequest)

Retrieves changesets for each of the requested getCommitIds() commits}, including the first page of changes between each commit and its first parent.

If the page size is less than the size of the collection of IDs, a subset of the collection will be returned. Otherwise, changesets for all IDs in the requested collection are returned.

Note: "Changeset" in this context represents a fundamentally different concept than the previous, now-deprecated Changeset class. This is the replacement for getDetailedChangesets(DetailedChangesetsRequest, PageRequest), which is also deprecated and will be removed in 4.0 along with DetailedChangeset. See Changeset for a description of what a "changeset" is, compared to a commit.

Parameters
request request parameters, specifying the repository and the desired commits
pageRequest the start and limit of the page being request
Returns
  • a page containing changesets for a subset of the requested IDs
Throws
NoSuchCommitException if ignoreMissing is not set and any of the requested commits cannot be found

@Deprecated @Nonnull public Page<Changeset> getChangesets (Repository repository, String changesetId, String path, PageRequest pageRequest)

This method is deprecated.
in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommits(CommitsRequest, PageRequest) instead.

Retrieves a page of changesets for the provided path on the specified branch.

If the provided changesetId is null, the default branch for the repository will be assumed. If the path is null, changesets are returned starting from (and including) the provided changesetId (where, again, the repository's default branch will be used if null). As a result this service call may be used to:

  • Retrieve pages of changesets on a given branch or tag
  • Retrieve pages of ancestral changesets for a given changeset
  • Retrieve pages of changesets where a given file has be modified
Each usage is for a single starting point. This means a single branch, tag or changeset. For example, retrieving all changesets where a given file has been modified on all branches is not possible.

Note: If the provided path is renamed at some point in its history, changesets will not follow the path across the rename. In other words, only changesets for the exact path provided will be included.

Parameters
repository the repository to find the changesets and path in
changesetId the starting changeset from which to search for other changesets, which may be a branch or tag name or a changeset hash
path the path find changesets for
pageRequest the start and limit for the page being requested
Returns
  • a page of changes

@Deprecated @Nonnull public Page<Changeset> getChangesetsBetween (ChangesetsBetweenRequest request, PageRequest pageRequest)

This method is deprecated.
in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommitsBetween(CommitsBetweenRequest, PageRequest) instead.

Retrieves a page of changesets between the included changesets and the excluded changesets. Included and excluded changesets may be specified by branch or tag name or by hash. The changesets returned are those which are reachable an included changeset and not reachable from any excluded changeset. While this may imply an ancestral relationship between include and exclude IDs, that is not strictly required. When the IDs are unrelated, all changesets referenceable from included changesets are candidates for the returned page, and excluded changesets are effectively ignored. Paths may be provided to further narrow the results, restricting the returned changesets to only those affecting one or more of the specified paths.

Which changesets are included and which are excluded is important here. Consider the following example:

  1. Branch "feature-A" was created from "master" when "master" was at changeset A
  2. Changesets FA1, FA2 and FA3 were created on the "feature-A" branch
  3. Changesets B and C were made on "master" after the branch was created
The graph would look like this:
 ---- A ---- B ---- C
       \
        \
        FA1 ---- FA2 ---- FA3
 
If "master" is excluded and "feature-A" is included, changesets FA1, FA2 and FA3 will be returned, because they are reachable from "feature-A" but not from "master". If the two IDs were reversed, changesets B and C would be returned, because they are reachable from "master" but not from "feature-A". This approach of swapping includes and excludes can be used to determine how two branches have diverged over time.

Warning: Changesets specified using branch or tag names, will be resolved against the primary repository. When retrieving changesets between repositories, changesets in the secondary repository may only be specified by hash. This means requesting a page like this will not work:


     ChangesetsBetweenRequest request = new ChangesetsBetweenRequest.Builder(repository)
             .exclude("master")
             .include("master")
             .secondaryRepository(forkOfRepository)
             .build();
     Page<Changeset> page = commitService.getChangesetsBetween(request, PageUtils.newRequest(0, 25));
 
The returned page will always be empty, because "master" was resolved on both sides using the same repository, and so it produced the same changeset to include and exclude.

Parameters
request the changesets to include/exclude, paths to filter by and which repository, or repositories, contain the changesets
pageRequest the start and limit for the page being requested
Returns
  • a page containing 0 or more changesets reachable from any included changesets and not reachable from any excluded ones

@Nonnull public Comment getComment (Repository repository, String commitId, long commentId)

Retrieves a the specified comment by its ID.

Parameters
repository the ID of the repository containing the commit
commitId the ID of the commit within the repository
commentId the ID of the comment to retrieve
Returns
  • the retrieved comment
Throws
NoSuchCommentException if no comment exists with the specified ID

@Nonnull public Commit getCommit (CommitRequest request)

Retrieves a commit based on te provided request.

If only a commit ID is specified, that commit will be returned if it exists. If a path is also provided, the first commit starting from the specified commit ID which modifies that path is returned. If the specified commit does not exist, or if no commit in the ancestry of that commit modifies the specified path, a NoSuchCommitException is thrown.

When retrieving a commit, extra properties can also be loaded. Properties are metadata associated with commits by CommitIndexers. Until 4.0, the extra properties requested also control the attributes that are loaded. Attributes will be removed in 4.0.

Parameters
request describes the commit to retrieve, and the repository to retrieve it from
Returns
  • the first commit matching the request within the specified repository
Throws
NoSuchCommitException if no matching commit can be found

@Nonnull public Page<Commit> getCommits (CommitsRequest request, PageRequest pageRequest)

Retrieves a page of commits, starting from a given branch, tag or commit, optionally filtered to only return commits which modify one or more paths. Commits are returned starting from (and including) the specified getCommitId(), unless one or more paths are provided. Then the first commit returned, if any are returned, will be the first commit in the ancestry of the specified starting commit which modifies at least one of the specified files.

This service call may be used to:

  • Retrieve pages of commits on a given branch or tag
  • Retrieve pages of ancestors starting from a given commit
  • Retrieve pages of commits where at least one file from a specified set of files has been modified
Each request is for a single starting point. This means a single branch, tag or commit. For example, retrieving all commits across all of a repository's branches where a given file has been modified in a single request is not possible.

When retrieving commits, extra properties can also be loaded. Properties are metadata associated with commits by CommitIndexers. Until 4.0, the extra properties requested also control the attributes that are loaded. Attributes will be removed in 4.0.

Note: If any of the provided paths is renamed at some point in its history, commits will not follow the path across the rename. In other words, only commits for exact paths provided will be included.

Parameters
request describes the commits to retrieve, and the repository to retrieve them from
pageRequest the start and limit for the page being requested
Returns
  • a page of commits, which may be empty but will never be null

@Nonnull public Page<Commit> getCommitsBetween (CommitsBetweenRequest request, PageRequest pageRequest)

Retrieves a page of commits between the included commits and the excluded commits. Included and excluded commits may be specified by branch or tag name or by commit ID. The commits returned are those which are reachable an included commit and not reachable from any excluded commit. While this may imply an ancestral relationship between included and excluded IDs, that is not strictly required. When the IDs are unrelated, all commits reachable from the included commits are candidates for the returned page, and excluded commits are effectively ignored. One or more paths may be provided to further narrow the results, restricting the returned commits to only which modify one or more of the specified paths.

Which commits are included and which are excluded is important here. Consider the following example:

  1. Branch "feature-A" was created from "master" when "master" was at commit A
  2. Commits FA1, FA2 and FA3 were created on the "feature-A" branch
  3. Commits B and C were made on "master" after the branch was created
The graph would look like this:
 ---- A ---- B ---- C
       \
        \
        FA1 ---- FA2 ---- FA3
 
If "master" is excluded and "feature-A" is included, commits FA1, FA2 and FA3 will be returned because they are reachable from "feature-A" but not from "master". If the two IDs were reversed, commits B and C would be returned, because they are reachable from "master" but not from "feature-A". This approach of swapping includes and excludes can be used to determine how two branches have diverged over time.

When retrieving commits, extra properties can also be loaded. Properties are metadata associated with commits by CommitIndexers. Until 4.0, the extra properties requested also control the attributes that are loaded. Attributes will be removed in 4.0.

Warning: Commits specified using branch or tag names will be resolved against the primary repository. When retrieving commits between repositories, commits in the secondary repository may only be specified by commit ID. This means requesting a page like this will not work:


     CommitsBetweenRequest request = new CommitsBetweenRequest.Builder(repository)
             .exclude("master")
             .include("master")
             .secondaryRepository(forkOfRepository)
             .build();
     Page<Commit> page = commitService.getCommitsBetween(request, PageUtils.newRequest(0, 25));
 
The returned page will always be empty because "master" was resolved on both sides using the same repository, producing the same commit to include and exclude. This also demonstrates that excludes take precedence over includes, as one might expect.

Parameters
request describes the commits to include/exclude, paths to filter by and which repository, or repositories, contain the commits
pageRequest the start and limit for the page being requested
Returns
  • a page containing 0 or more commits reachable from any included commit and not reachable from any excluded ones

@Deprecated @Nonnull public Page<DetailedChangeset> getDetailedChangesets (DetailedChangesetsRequest request, PageRequest pageRequest)

This method is deprecated.
in 3.7 for removal in 4.0. With the removal of Changeset in 4.0, DetailedChangeset can be renamed to what it really is: Changeset. The "Detailed" prefix was added purely because the real name, Changeset, was already being used to describe something else. Use getChangesets(ChangesetsRequest, PageRequest) instead.

Retrieves each of the changesets in getChangesetIds() changesetIds} and returns their details, including the first page of changes between the changeset in question and its first parent.

If the page size is less than the size of the collection of IDs, a subset of the collection will be returned. Otherwise, detailed changesets for all IDs in the requested collection are returned.

Parameters
request request parameters, including repository and the relevant changesets
pageRequest the start and limit of the page being request
Returns
  • a page containing detailed changesets for a subset of the requested IDs
Throws
NoSuchCommitException if ignoreMissing is not set and any of the requested commits cannot be found

public void streamChanges (ChangesRequest request, ChangeCallback callback)

Streams changes between the until and since changesets. If the since changeset is not specified, the until changeset's first parent is used automatically.

Note: The implementation will apply a hard cap (page.max.changes) and it is not possible to request subsequent content when that cap is exceeded.

Parameters
request describes the two changesets to retrieve changes between and the repository which contains both changesets
callback the callback for receiving the changes

@Deprecated public void streamChangesetsBetween (ChangesetsBetweenRequest request, ChangesetCallback callback)

This method is deprecated.
in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use streamCommitsBetween(CommitsBetweenRequest, CommitCallback) instead.

Streams changesets between the included changesets and the excluded changesets.

This method promises to call onStart(ChangesetContext) on the supplied callback once followed by zero or more calls to onChangeset(Changeset), one for each changeset to be streamed (until false is returned by onChangeset(...) or there are no more changesets), followed by a single call to onEnd(ChangesetSummary).

See getChangesetsBetween(...) for a description of the semantics of the changesets returned.

Parameters
request the changesets to include/exclude, paths to filter by and which repository, or repositories, contain the changesets
callback the callback for receiving the changesets

public void streamCommits (CommitsRequest request, CommitCallback callback)

Streams commits, starting from a given branch, tag or commit, optionally filtered to only include commits which modify one or more paths. Commits are streamed starting from (and including) the specified getCommitId(), unless one or more paths are provided. Then the first commit streamed, if any are, will be the first commit in the ancestry of the specified starting commit which modifies at least one of the specified files.

This service call may be used to:

  • Stream the commits on a given branch or tag
  • Stream ancestors starting from a given commit
  • Stream commits where at least one file from a specified set of files has been modified
Each request is for a single starting point. This means a single branch, tag or commit. For example, streaming all commits across all of a repository's branches where a given file has been modified in a single request is not possible.

When streaming commits, extra properties can also be loaded. Properties are metadata associated with commits by CommitIndexers. Until 4.0, the extra properties requested also control the attributes that are loaded. Attributes will be removed in 4.0.

Note: If any of the provided paths is renamed at some point in its history, commits will not follow the path across the rename. In other words, only commits for exact paths provided will be included.

Parameters
request describes the commits to stream, and the repository to stream them from
callback a callback to receive the commits

public void streamCommitsBetween (CommitsBetweenRequest request, CommitCallback callback)

Streams commits between the included commits and the excluded commits.

This method promises to call onStart(CommitContext) on the supplied callback exactly once, followed by zero or more calls to onCommit(Commit), one for each commit to be streamed (until onCommit(...) returns false or there are no more commits), followed by exactly one call to onEnd(CommitSummary).

See getCommitsBetween(...) for a description of the semantics of the commits returned.

Parameters
request describes the commits to include/exclude, paths to filter by and which repository, or repositories, contain the commits
callback a callback to receive the commits

public void streamDiff (DiffRequest request, DiffContentCallback callback)

Streams diff output for the specified paths at the specified changeset.

Note: This interface is currently not paged. The implementation will apply a hard cap (page.max.diff.lines) and it is not possible to request subsequent content when that cap is exceeded.

Parameters
request the repository, starting and terminating changsets, paths to filter
callback the callback for receiving the diff details

public void traverse (TraversalRequest request, TraversalCallback callback)

Traverse the graph of commits in topological order, optionally supplying included commits to start from and excluded commits to ignore.

Parameters
request the traversal request describing the repository and the commits to include and exclude
callback the callback to receive the traversed commits

public boolean unwatch (Repository repository, String commitId)

Removes the current user as a watcher for the specified commit, which will prevent further notifications from being dispatched to that user.

Parameters
repository the ID of the repository containing the commit
commitId the ID of the commit within the repository
Returns
  • true if the watcher existed (and thus was removed); otherwise false

@Nonnull public Comment updateComment (Repository repository, String commitId, long commentId, int commentVersion, String commentText)

Updates the text for the specified comment.

Parameters
repository the ID of the repository containing the commit
commitId the ID of the commit within the repository
commentId the ID of the comment to update
commentVersion the expected version of the comment
commentText the new text for the comment
Returns
  • the updated comment
Throws
CommentOutOfDateException if the version of the specified comment does not match the expected version
NoSuchCommentException if no comment exists with the specified ID

@Nonnull public Watcher watch (Repository repository, String commitId)

Adds the current user as a watcher for the specified commit. Watchers receive notifications when new comments are added to the commit.

Parameters
repository the ID of the repository containing the commit
commitId the ID of the commit within the repository
Returns
  • the created watcher