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
RepositoryRefsChangedEvents.
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionPullRequestMergedEvent(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.booleanbooleanMethods inherited from class com.atlassian.bitbucket.event.pull.PullRequestEvent
getAction, getPullRequestMethods inherited from class com.atlassian.bitbucket.event.ApplicationEvent
getDate, getUserMethods inherited from class java.util.EventObject
getSource, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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 commitis 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 commitshould be provided if the pull request was merged by the system, and should be leftnullif 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 bynullif 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 commitshould be provided if the pull request was merged by the system, and should be leftnullif 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 bynullif the pull request was merged remotely and pushed upmessage- the commit message, which may benullstrategyId- the strategy used to merge the pull requestautoMerge-trueif the pull request wasauto-mergedby the system on behalf of a user; otherwisefalse- Since:
- 8.14
-
-
Method Details
-
getCommit
- Returns:
- the merge commit, which may be
nullif the pull request was merged remotely
-
getMessage
- Returns:
- the proposed commit message, which may be
null
-
getRefChanges
Description copied from interface:RepositoryRefsChangedEventRetrieves a collection of thechanged refs.Note: While the returned collection will never be
null, it may be empty. For example, aremotely merged pull requestwill have an empty set of changes.- Specified by:
getRefChangesin interfaceRepositoryRefsChangedEvent- Returns:
- a collection of
updated refswhich 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:RepositoryRefsChangedEventRetrieves the repository in which refs were changed. All of thechanged refsfor a single event will always be in the same repository.- Specified by:
getRepositoryin 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:
trueif the pull request wasauto-mergedby the system on behalf of a user; otherwisefalse- Since:
- 8.14
- See Also:
-
isMergedRemotely
public boolean isMergedRemotely()- Returns:
trueif the pull request was merged remotely and pushed up; otherwise,falseif the pull request was merged via the web UI or REST
-