@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 that is raised when a pull request is merged.

If the pull request was merged by the system, the changeset resulting from the merge (which may or may not be a merge commit, depending on the configured merge strategy) will be included. Otherwise, if the pull request was merged remotely, meaning a changeset which was a descendant of the from ref was pushed to the to ref, the changeset 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, MinimalChangeset changeset)
Constructs a new PullRequestMergedEvent.
Public Methods
@Nullable MinimalChangeset getChangeset()
@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, MinimalChangeset changeset)

Constructs a new PullRequestMergedEvent. The changeset 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 changeset that resulted from the merging the pull request in the web UI or the REST resource. If null it indicates the pull request was merged remotely and pushed to Stash.

Public Methods

@Nullable public MinimalChangeset getChangeset ()

@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 containing 0 or more changed refs

@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 containing the changed refs

public boolean isMergedRemotely ()

Returns
  • true if the pull request was merged remotely and pushed to Stash. false if the pull request was merged through the web UI/REST resource.