public interface

ScmPullRequestCommandFactory

com.atlassian.bitbucket.scm.pull.ScmPullRequestCommandFactory

Class Overview

Creates commands which provide pull request functionality. Each method accepts a set of CommandParameters which are used to control the command's behaviour and output.

Plugin developers: This is probably not the interface you want to use. PullRequestService automatically chooses the correct SCM based on the repository, and provides a more stable, compatible API. The documentation for each method on this interface includes a link to the API service method or methods which expose it.

Summary

Public Methods
@Nonnull @Deprecated Command<Boolean> canMerge()
This method is deprecated. in 4.10 for removal in 5.0. Use tryMerge(PullRequest) instead.
@Nonnull Command<Void> changes(PullRequestChangeCommandParameters parameters, ChangeCallback callback)
@Nonnull Command<Void> commits(CommitCallback callback)
@Nonnull Command<Void> diff(PullRequestDiffCommandParameters parameters, DiffContentCallback callback)
@Nonnull Command<PullRequestEffectiveDiff> effectiveDiff()
Retrieves the effective diff for the pull request.
@Nonnull Command<Branch> merge(PullRequestMergeCommandParameters parameters)
@Nonnull Command<PullRequestMergeResult> tryMerge(PullRequest pullRequest)
Attempt to merge the pull request to determine what the expected result of actually merging it would be.

Public Methods

@Nonnull @Deprecated public Command<Boolean> canMerge ()

This method is deprecated.
in 4.10 for removal in 5.0. Use tryMerge(PullRequest) instead.

Returns
  • a command which, when executed, will return true if the pull request can be merged cleanly by the SCM or false if there are conflicts or other SCM-specific issues which prevent the SCM from merging it

@Nonnull public Command<Void> changes (PullRequestChangeCommandParameters parameters, ChangeCallback callback)

Parameters
parameters parameters describing how many changes to stream, and potentially for which paths
callback a callback to receive changes
Returns
  • a command which, when executed, will stream the changes the pull request wants to apply

@Nonnull public Command<Void> commits (CommitCallback callback)

Parameters
callback a callback to receive commits
Returns
  • a command which, when executed, will stream the commits that are reachable from the from ref and not reachable from the to ref

@Nonnull public Command<Void> diff (PullRequestDiffCommandParameters parameters, DiffContentCallback callback)

Parameters
parameters parameters describing the paths to diff and what should be included in the diffs generated
callback a callback to receive the diff
Returns
  • a command which, when executed, will stream the diff for the specified paths

@Nonnull public Command<PullRequestEffectiveDiff> effectiveDiff ()

Retrieves the effective diff for the pull request. The "effective diff" is comprised of the two commits that should be compared to get a view of what changes the pull request includes. When new commits are added to either of the branches involved in a pull request, the pull request's effective diff may change.

Note: This method is not exposed via the service API. It is only available directly on the SCM API. The effective diff is something plugin developers generally do not need to be explicitly aware of. Instead, the commits, changes(PullRequestChangeCommandParameters, ChangeCallback) and diff(PullRequestDiffCommandParameters, DiffContentCallback) should be retrieved using their commands.

Returns
  • a command which, when executed, will retrieve the commit IDs which describe the pull request's current effective diff

@Nonnull public Command<Branch> merge (PullRequestMergeCommandParameters parameters)

Parameters
parameters parameters describing additional context which an SCM may consider when merging the pull request, potentially altering the way final shape of the merge
Returns
  • a command which, when executed, will merge the pull request, applying its changes to the target branch

@Nonnull public Command<PullRequestMergeResult> tryMerge (PullRequest pullRequest)

Attempt to merge the pull request to determine what the expected result of actually merging it would be.

Parameters
pullRequest the pull request to test for merge-ability
Returns
  • the result of trying to merge the pull request