public interface

MergeRequest

com.atlassian.bitbucket.scm.pull.MergeRequest

Class Overview

Represents a request to merge a pull request, intended to allow MergeRequestChecks to validate the intended merge and, potentially, veto(String, String) it.

See Also

Summary

Public Methods
@Nonnull Map<StringObject> getContext()
Retrieves any additional context that was supplied when the merge was requested.
@Nullable String getMessage()
Retrieves the proposed commit message, if one was provided.
@Nonnull PullRequest getPullRequest()
boolean isDryRun()
Retrieves a flag indicating whether this request is for a canMerge check or a real merge.
boolean isVetoed()
void veto(String summaryMessage, String detailedMessage)
If called, signifies that the calling check wishes to veto the merge.

Public Methods

@Nonnull public Map<StringObject> getContext ()

Retrieves any additional context that was supplied when the merge was requested. This context is intended to allow plugin developers to implement their own behavior around pull request merges. As a result, its contents are unspecified; they depend on the installed plugins.

On dry runs, the context will always be empty.

Returns
  • additional context provided when the merge was requested, if any

@Nullable public String getMessage ()

Retrieves the proposed commit message, if one was provided.

On dry runs, the commit message will always be null.

Returns
  • the proposed commit message, which will be null for canMerge checks and may be null for merge requests

@Nonnull public PullRequest getPullRequest ()

Returns
  • the pull request to be merged

public boolean isDryRun ()

Retrieves a flag indicating whether this request is for a canMerge check or a real merge.

This flag is intended to allow MergeRequestChecks to apply different validation, if necessary, between canMerge and merge requests. For example, a MergeRequestCheck to validate the commit message would not be applied on a dry run, because the commit message is only supplied when the merge is actually performed.

Returns
  • true if this is a canMerge check; otherwise, false if it is a merge request

public boolean isVetoed ()

Returns

public void veto (String summaryMessage, String detailedMessage)

If called, signifies that the calling check wishes to veto the merge.

Parameters
summaryMessage a simple summary of why the merge is being vetoed
detailedMessage a detailed explanation of why the merge is being vetoed