@AsynchronousPreferred public class

PullRequestMergedEvent

extends PullRequestEvent
implements RepositoryRefsChangedEvent
java.lang.Object
   ↳ java.util.EventObject
     ↳ com.atlassian.stash.event.StashEvent
       ↳ com.atlassian.stash.event.pull.PullRequestEvent
         ↳ com.atlassian.stash.event.pull.PullRequestMergedEvent

Class Overview

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.

Summary

[Expand]
Inherited Fields
From class java.util.EventObject
Public Constructors
PullRequestMergedEvent(Object source, PullRequest pullRequest)
Constructs a new PullRequestMergedEvent.
@Deprecated PullRequestMergedEvent(Object source, PullRequest pullRequest, MinimalChangeset changeset)
This constructor is deprecated. in 3.7 for removal in 4.0. Use PullRequestMergedEvent(Object, PullRequest, MinimalChangeset, String, Map) instead.
@Deprecated PullRequestMergedEvent(Object source, PullRequest pullRequest, MinimalChangeset changeset, String message, Map<StringObject> context)
This constructor is deprecated. in 3.11. The MinimalChangeset will be replaced by MinimalCommit in 4.0. Plugin developers are only expected to consume this event, not raise it, so this change should not affect them.
Public Methods
@Deprecated @Nullable MinimalChangeset getChangeset()
This method is deprecated. in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommit() instead.
@Nullable MinimalCommit getCommit()
@Nonnull Map<StringObject> getContext()
@Nullable String getMessage()
@Nonnull Collection<RefChange> getRefChanges()
Retrieves a collection of the changed refs.
@Nonnull Repository getRepository()
Retrieves the repository in which refs were changed.
boolean isMergedRemotely()
[Expand]
Inherited Methods
From class com.atlassian.stash.event.pull.PullRequestEvent
From class com.atlassian.stash.event.StashEvent
From class java.util.EventObject
From class java.lang.Object
From interface com.atlassian.stash.event.RepositoryRefsChangedEvent

Public Constructors

public PullRequestMergedEvent (Object source, PullRequest pullRequest)

Constructs a new PullRequestMergedEvent. This is a convenience constructor for remotely-merged pull requests, where the merge commit is not known.

Parameters
source the entity raising the event
pullRequest the pull request that was merged

@Deprecated public PullRequestMergedEvent (Object source, PullRequest pullRequest, MinimalChangeset changeset)

This constructor is deprecated.
in 3.7 for removal in 4.0. Use PullRequestMergedEvent(Object, PullRequest, MinimalChangeset, String, Map) instead.

Constructs a new PullRequestMergedEvent. The merge commit should be provided if the pull request was merged by the system, and should be left null if the merge was pushed by a user.

Parameters
source the entity raising the event
pullRequest the pull request that was merged
changeset the commit that resulted from the merging the pull request via the web UI or REST, which may by null if the pull request was merged remotely and pushed up

@Deprecated public PullRequestMergedEvent (Object source, PullRequest pullRequest, MinimalChangeset changeset, String message, Map<StringObject> context)

This constructor is deprecated.
in 3.11. The MinimalChangeset will be replaced by MinimalCommit in 4.0. Plugin developers are only expected to consume this event, not raise it, so this change should not affect them.

Constructs a new PullRequestMergedEvent. The merge commit should be provided if the pull request was merged by the system, and should be left null if the merge was pushed by a user.

Parameters
source the entity raising the event
pullRequest the pull request that was merged
changeset the commit that resulted from the merging the pull request via the web UI or REST, which may by null if the pull request was merged remotely and pushed up
message the commit message, which may be null
context additional context provided when merging the pull request, intended to allow plugins to add their own functionality around the merge operation

Public Methods

@Deprecated @Nullable public MinimalChangeset getChangeset ()

This method is deprecated.
in 3.7 for removal in 4.0. All things "changeset" are being renamed to "commit", the more common term for the data they represent. Use getCommit() instead.

Returns
  • the merge commit, which may be null if the pull request was merged remotely

@Nullable public MinimalCommit getCommit ()

Returns
  • the merge commit, which may be null if the pull request was merged remotely

@Nonnull public Map<StringObject> getContext ()

Returns
  • additional context provided when the merge was requested

@Nullable public String getMessage ()

Returns
  • the proposed commit message, which may be null

@Nonnull public Collection<RefChange> getRefChanges ()

Retrieves a collection of the changed refs.

Note: While the returned collection will never be null, it may be empty. For example, a remotely merged pull request will have an empty set of changes.

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's target branch, if the pull request was merged via the web UI or REST

@Nonnull public Repository getRepository ()

Retrieves the repository in which refs were changed. All of the changed refs for a single event will always be in the same repository.

Returns
  • the repository into which the pull request was merged

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