com.atlassian.bitbucket.scm.pull.BulkRescopeContext |
Provides a context for SCMs to detect pull request rescopes
when a repository is updated.
For the SCM it does not matter what pull request is being rescoped by each of the
rescopes
. To keep the SPI as simple and flexible as possible, only the repositories and
the hashes are made available. The pull requests are not provided. The provided rescopes may be subsequent rescopes
of the same pull request, rescopes for different pull requests or a mix. At the SCM level it's irrelevant.
The rescopes are guaranteed to:
oldFromHash
will differ from the newFromHash
, the oldToHash
will
differ from the newToHash
, or botholdFromHash
, oldToHash
or newToHash
equal to null
. Only
newFromHash
can ever be null
. A null newToHash
would always result in a decline
of the pull request, which the system can detect without the SCM. A null newFromHash
on the other
hand could result in a decline or a merge, depending on whether the from-branch has been merged into the
to-branch before it was deleted.newFromHash
is null
, the SCM shall
Merge
the pull request if the SCM allows updating multiple branches in a single push
and the oldFromHash
is now reachable from the
newToHash
, orDecline
the pull request if its commits have not been merged to the targetMerge
: If the source or target ref for the pull request has been
updated in such a way that there are no commits on the source that are not also on the target, the SCM
shall classify the rescope as merging the pull request, with 1 exception (detailed below)
merge
callback.Update
: If new commits have been added
to the source
or target
refs,
the SCM shall classify the rescope as updating the pull request. The SCM shall also detect
how many commits, if any, have been added to and removed from the scope of the pull request, which is defined
as the commits that are reachable from the source ref, but not the target ref. The SCM shall not
provide more than getMaxCommitIds()
commit IDs in the addedCommitIds
or
removedCommitIds
lists.
rescope
in the context may be classified exactly once. Additionally,
only rescopes
retrieved from the context may be provided back
to it for declining
, merging
or
update(PullRequestRescope, RescopeDetails, RescopeDetails)
updating}.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Marks the rescope as
declining the associated pull request. | |||||||||||
Marks the rescope as
remotely merging the associated pull request. | |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
java.lang.Iterable
|
Marks the rescope as declining
the associated pull request.
rescope | the rescope |
---|
IllegalArgumentException | if the provided rescope was not returned by this context
|
---|
update(PullRequestRescope, RescopeDetails, RescopeDetails)
Marks the rescope as remotely merging
the associated pull request.
When a pull request is remotely merged, the SCM can optionally detect and provide the commit which actually carried out the merge. It is only required to detect that the pull request's refs have changed in a way which removes all of the pull request's incoming commits.
rescope | the rescope |
---|
IllegalArgumentException | if the provided rescope was not returned by this context
|
---|
Marks the rescope as updating one or both of the associated pull request's
from
and to
refs.
The SCM is required to not only detect that the rescope does not merge or decline the pull request, it is also required to detect how many and which commits were added and/or removed from the scope of the pull request.
For performance reasons, only a limited number of commit IDs should be returned. Implementors should call
getMaxCommitIds()
to discover how many commit IDs can be returned.
rescope | the rescope |
---|---|
addedCommits | details about how many and what commits were added to the the pull request |
removedCommits | details about how many and what commits were removed from the pull request |
IllegalArgumentException | if the provided rescope was not returned by this context
|
---|