Class PullRequestMergedEvent
java.lang.Object
java.util.EventObject
com.atlassian.bitbucket.event.ApplicationEvent
com.atlassian.bitbucket.event.pull.PullRequestEvent
com.atlassian.bitbucket.event.pull.PullRequestMergedEvent
- All Implemented Interfaces:
RepositoryRefsChangedEvent
,Serializable
@AsynchronousPreferred
public class PullRequestMergedEvent
extends PullRequestEvent
implements RepositoryRefsChangedEvent
Event raised when a pull request is merged via the web UI or REST, or when a remote merge is detected.
If the pull request was merged by the system, the commit
resulting from the merge (which
may or may not be a literal merge commit, depending on the configured merge strategy) will be included. Otherwise,
if the pull request was merged remotely
, meaning a commit which is a descendant of the
from ref
was pushed to the to ref
, the commit
will not be provided.
Listeners that are interested in all repository changes (and not just pull request merges) should listen for
RepositoryRefsChangedEvent
s.
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionPullRequestMergedEvent
(Object source, PullRequest pullRequest) Constructs a newPullRequestMergedEvent
.PullRequestMergedEvent
(Object source, PullRequest pullRequest, MinimalCommit commit, String message) Constructs a newPullRequestMergedEvent
.PullRequestMergedEvent
(Object source, PullRequest pullRequest, MinimalCommit commit, String message, String strategyId, boolean autoMerge) Constructs a newPullRequestMergedEvent
. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves a collection of thechanged refs
.Retrieves the repository in which refs were changed.boolean
boolean
Methods inherited from class com.atlassian.bitbucket.event.pull.PullRequestEvent
getAction, getPullRequest
Methods inherited from class com.atlassian.bitbucket.event.ApplicationEvent
getDate, getUser
Methods inherited from class java.util.EventObject
getSource, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.atlassian.bitbucket.event.repository.RepositoryRefsChangedEvent
getUser
-
Constructor Details
-
PullRequestMergedEvent
Constructs a newPullRequestMergedEvent
. This is a convenience constructor for remotely-merged pull requests, where themerge commit
is not known.- Parameters:
source
- the entity raising the eventpullRequest
- the pull request that was merged
-
PullRequestMergedEvent
public PullRequestMergedEvent(@Nonnull Object source, @Nonnull PullRequest pullRequest, @Nullable MinimalCommit commit, @Nullable String message) Constructs a newPullRequestMergedEvent
. Themerge commit
should be provided if the pull request was merged by the system, and should be leftnull
if the merge was pushed by a user.- Parameters:
source
- the entity raising the eventpullRequest
- the pull request that was mergedcommit
- the commit that resulted from the merging the pull request via the web UI or REST, which may bynull
if the pull request was merged remotely and pushed upmessage
- the commit message, which may benull
- Since:
- 8.14
-
PullRequestMergedEvent
public PullRequestMergedEvent(@Nonnull Object source, @Nonnull PullRequest pullRequest, @Nullable MinimalCommit commit, @Nullable String message, @Nullable String strategyId, boolean autoMerge) Constructs a newPullRequestMergedEvent
. Themerge commit
should be provided if the pull request was merged by the system, and should be leftnull
if the merge was pushed by a user.- Parameters:
source
- the entity raising the eventpullRequest
- the pull request that was mergedcommit
- the commit that resulted from the merging the pull request via the web UI or REST, which may bynull
if the pull request was merged remotely and pushed upmessage
- the commit message, which may benull
strategyId
- the strategy used to merge the pull requestautoMerge
-true
if the pull request wasauto-merged
by the system on behalf of a user; otherwisefalse
- Since:
- 8.14
-
-
Method Details
-
getCommit
- Returns:
- the merge commit, which may be
null
if the pull request was merged remotely
-
getMessage
- Returns:
- the proposed commit message, which may be
null
-
getRefChanges
Description copied from interface:RepositoryRefsChangedEvent
Retrieves a collection of thechanged refs
.Note: While the returned collection will never be
null
, it may be empty. For example, aremotely merged pull request
will have an empty set of changes.- Specified by:
getRefChanges
in interfaceRepositoryRefsChangedEvent
- Returns:
- a collection of
updated refs
which may be empty, if the pull request was merged remotely, or contain a single updated ref for the pull request'starget branch
, if the pull request was merged via the web UI or REST
-
getRepository
Description copied from interface:RepositoryRefsChangedEvent
Retrieves the repository in which refs were changed. All of thechanged refs
for a single event will always be in the same repository.- Specified by:
getRepository
in interfaceRepositoryRefsChangedEvent
- Returns:
- the repository into which the pull request was merged
-
getStrategyId
- Returns:
- the ID of the strategy used to merge the pull request
- Since:
- 4.9
-
isAutoMerge
public boolean isAutoMerge()- Returns:
true
if the pull request wasauto-merged
by the system on behalf of a user; otherwisefalse
- Since:
- 8.14
- See Also:
-
isMergedRemotely
public boolean isMergedRemotely()- Returns:
true
if the pull request was merged remotely and pushed up; otherwise,false
if the pull request was merged via the web UI or REST
-