GetMergeOptionsCommand

Returns information about the merge options available for merging two specified branches. For details about why a merge option is not available, use GetMergeConflicts or DescribeMergeConflicts.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CodeCommitClient, GetMergeOptionsCommand } from "@aws-sdk/client-codecommit"; // ES Modules import
// const { CodeCommitClient, GetMergeOptionsCommand } = require("@aws-sdk/client-codecommit"); // CommonJS import
const client = new CodeCommitClient(config);
const input = { // GetMergeOptionsInput
  repositoryName: "STRING_VALUE", // required
  sourceCommitSpecifier: "STRING_VALUE", // required
  destinationCommitSpecifier: "STRING_VALUE", // required
  conflictDetailLevel: "FILE_LEVEL" || "LINE_LEVEL",
  conflictResolutionStrategy: "NONE" || "ACCEPT_SOURCE" || "ACCEPT_DESTINATION" || "AUTOMERGE",
};
const command = new GetMergeOptionsCommand(input);
const response = await client.send(command);
// { // GetMergeOptionsOutput
//   mergeOptions: [ // MergeOptions // required
//     "FAST_FORWARD_MERGE" || "SQUASH_MERGE" || "THREE_WAY_MERGE",
//   ],
//   sourceCommitId: "STRING_VALUE", // required
//   destinationCommitId: "STRING_VALUE", // required
//   baseCommitId: "STRING_VALUE", // required
// };

GetMergeOptionsCommand Input

See GetMergeOptionsCommandInput for more details

Parameter
Type
Description
destinationCommitSpecifier
Required
string | undefined

The branch, tag, HEAD, or other fully qualified reference used to identify a commit (for example, a branch name or a full commit ID).

repositoryName
Required
string | undefined

The name of the repository that contains the commits about which you want to get merge options.

sourceCommitSpecifier
Required
string | undefined

The branch, tag, HEAD, or other fully qualified reference used to identify a commit (for example, a branch name or a full commit ID).

conflictDetailLevel
ConflictDetailLevelTypeEnum | undefined

The level of conflict detail to use. If unspecified, the default FILE_LEVEL is used, which returns a not-mergeable result if the same file has differences in both branches. If LINE_LEVEL is specified, a conflict is considered not mergeable if the same file in both branches has differences on the same line.

conflictResolutionStrategy
ConflictResolutionStrategyTypeEnum | undefined

Specifies which branch to use when resolving conflicts, or whether to attempt automatically merging two versions of a file. The default is NONE, which requires any conflicts to be resolved manually before the merge operation is successful.

GetMergeOptionsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
baseCommitId
Required
string | undefined

The commit ID of the merge base.

destinationCommitId
Required
string | undefined

The commit ID of the destination commit specifier that was used in the merge evaluation.

mergeOptions
Required
MergeOptionTypeEnum[] | undefined

The merge option or strategy used to merge the code.

sourceCommitId
Required
string | undefined

The commit ID of the source commit specifier that was used in the merge evaluation.

Throws

Name
Fault
Details
CommitDoesNotExistException
client

The specified commit does not exist or no commit was specified, and the specified repository has no default branch.

CommitRequiredException
client

A commit was not specified.

EncryptionIntegrityChecksFailedException
server

An encryption integrity check failed.

EncryptionKeyAccessDeniedException
client

An encryption key could not be accessed.

EncryptionKeyDisabledException
client

The encryption key is disabled.

EncryptionKeyNotFoundException
client

No encryption key was found.

EncryptionKeyUnavailableException
client

The encryption key is not available.

InvalidCommitException
client

The specified commit is not valid.

InvalidConflictDetailLevelException
client

The specified conflict detail level is not valid.

InvalidConflictResolutionStrategyException
client

The specified conflict resolution strategy is not valid.

InvalidRepositoryNameException
client

A specified repository name is not valid.

This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.

MaximumFileContentToLoadExceededException
client

The number of files to load exceeds the allowed limit.

MaximumItemsToCompareExceededException
client

The number of items to compare between the source or destination branches and the merge base has exceeded the maximum allowed.

RepositoryDoesNotExistException
client

The specified repository does not exist.

RepositoryNameRequiredException
client

A repository name is required, but was not specified.

TipsDivergenceExceededException
client

The divergence between the tips of the provided commit specifiers is too great to determine whether there might be any merge conflicts. Locally compare the specifiers using git diff or a diff tool.

CodeCommitServiceException
Base exception class for all service exceptions from CodeCommit service.