public interface GitPullRequestService
PullRequestService
specific to working with pull requests between Git
repositories.Modifier and Type | Method and Description |
---|---|
PullRequestRebaseability |
canRebase(com.atlassian.bitbucket.pull.PullRequest pullRequest)
Checks preconditions to determine whether the specified
pull request can be rebased. |
Optional<com.atlassian.bitbucket.repository.RefChange> |
rebase(PullRequestRebaseRequest request)
Rebases a
pull request , updating the "from" ref with new
commits starting from the "to" ref . |
@Nonnull PullRequestRebaseability canRebase(@Nonnull com.atlassian.bitbucket.pull.PullRequest pullRequest)
pull request
can be rebased.
Some of the preconditions are:
"from" ref
is a branch
refs/heads/
git rebase
records the current user as the committer for the rebased commits, which
requires a name and e-mail address"from" ref
's repository
toRef
's repository, so just because a user can see
a pull request does not mean they can request a rebasePreRepositoryHook
s and handling GitRebaseHookRequest
s.pullRequest
- the pull request to check@Nonnull Optional<com.atlassian.bitbucket.repository.RefChange> rebase(@Nonnull PullRequestRebaseRequest request)
pull request
, updating the "from" ref
with new
commits starting from the "to" ref
.
Rebasing a pull request requires read
access to the "to" ref
's repository, and write
access to the "from" ref
's repository.
This operation checks branch permissions for the "from" ref. If the ref has been marked read only, or has
restrictions preventing changes without a pull request or rewriting history have been applied, the rebase
will be rejected and the ref will not be updated. Third-party add-ons can enforce additional checks by
implementing PreRepositoryHook
s and handling GitRebaseHookRequest
s.
This operation may discard one or more commits from the "from" ref if matching changes are already present on the "to" ref, but it may not discard all of the incoming commits. At least one unique commit must remain on the "from" ref or the rebase will fail. This means a pull request cannot be automatically closed as a byproduct of rebasing it.
After a pull request is successfully rebased, the refs in the database are updated asynchronously, so the new commits may not be immediately visible.
request
- a request describing the pull request to rebaseRefChange
describing how the pull request's "from" ref was updated, which may be
empty()
if the "from" ref is already up-to-date with all commits on the "to" refCopyright © 2019 Atlassian. All rights reserved.