mergePullRequestBySquash method
- required String pullRequestId,
- required String repositoryName,
- String? authorName,
- String? commitMessage,
- ConflictDetailLevelTypeEnum? conflictDetailLevel,
- ConflictResolution? conflictResolution,
- ConflictResolutionStrategyTypeEnum? conflictResolutionStrategy,
- String? email,
- bool? keepEmptyFolders,
- String? sourceCommitId,
Attempts to merge the source commit of a pull request into the specified destination branch for that pull request at the specified commit using the squash merge strategy. If the merge is successful, it closes the pull request.
May throw PullRequestAlreadyClosedException. May throw PullRequestDoesNotExistException. May throw PullRequestIdRequiredException. May throw InvalidPullRequestIdException. May throw InvalidCommitIdException. May throw ManualMergeRequiredException. May throw TipOfSourceReferenceIsDifferentException. May throw TipsDivergenceExceededException. May throw NameLengthExceededException. May throw InvalidEmailException. May throw CommitMessageLengthExceededException. May throw InvalidConflictDetailLevelException. May throw InvalidConflictResolutionStrategyException. May throw InvalidConflictResolutionException. May throw ReplacementTypeRequiredException. May throw InvalidReplacementTypeException. May throw MultipleConflictResolutionEntriesException. May throw ReplacementContentRequiredException. May throw MaximumConflictResolutionEntriesExceededException. May throw ConcurrentReferenceUpdateException. May throw PathRequiredException. May throw InvalidPathException. May throw InvalidFileModeException. May throw InvalidReplacementContentException. May throw FileContentSizeLimitExceededException. May throw FolderContentSizeLimitExceededException. May throw MaximumFileContentToLoadExceededException. May throw MaximumItemsToCompareExceededException. May throw RepositoryNameRequiredException. May throw InvalidRepositoryNameException. May throw RepositoryDoesNotExistException. May throw RepositoryNotAssociatedWithPullRequestException. May throw PullRequestApprovalRulesNotSatisfiedException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.
Parameter pullRequestId
:
The system-generated ID of the pull request. To get this ID, use
ListPullRequests.
Parameter repositoryName
:
The name of the repository where the pull request was created.
Parameter authorName
:
The name of the author who created the commit. This information is used as
both the author and committer for the commit.
Parameter commitMessage
:
The commit message to include in the commit information for the merge.
Parameter conflictDetailLevel
:
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.
Parameter conflictResolution
:
If AUTOMERGE is the conflict resolution strategy, a list of inputs to use
when resolving conflicts during a merge.
Parameter conflictResolutionStrategy
:
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.
Parameter email
:
The email address of the person merging the branches. This information is
used in the commit information for the merge.
Parameter keepEmptyFolders
:
If the commit contains deletions, whether to keep a folder or folder
structure if the changes leave the folders empty. If true, a .gitkeep file
is created for empty folders. The default is false.
Parameter sourceCommitId
:
The full commit ID of the original or updated commit in the pull request
source branch. Pass this value if you want an exception thrown if the
current commit ID of the tip of the source branch does not match this
commit ID.
Implementation
Future<MergePullRequestBySquashOutput> mergePullRequestBySquash({
required String pullRequestId,
required String repositoryName,
String? authorName,
String? commitMessage,
ConflictDetailLevelTypeEnum? conflictDetailLevel,
ConflictResolution? conflictResolution,
ConflictResolutionStrategyTypeEnum? conflictResolutionStrategy,
String? email,
bool? keepEmptyFolders,
String? sourceCommitId,
}) async {
ArgumentError.checkNotNull(pullRequestId, 'pullRequestId');
ArgumentError.checkNotNull(repositoryName, 'repositoryName');
_s.validateStringLength(
'repositoryName',
repositoryName,
1,
100,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CodeCommit_20150413.MergePullRequestBySquash'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'pullRequestId': pullRequestId,
'repositoryName': repositoryName,
if (authorName != null) 'authorName': authorName,
if (commitMessage != null) 'commitMessage': commitMessage,
if (conflictDetailLevel != null)
'conflictDetailLevel': conflictDetailLevel.toValue(),
if (conflictResolution != null)
'conflictResolution': conflictResolution,
if (conflictResolutionStrategy != null)
'conflictResolutionStrategy': conflictResolutionStrategy.toValue(),
if (email != null) 'email': email,
if (keepEmptyFolders != null) 'keepEmptyFolders': keepEmptyFolders,
if (sourceCommitId != null) 'sourceCommitId': sourceCommitId,
},
);
return MergePullRequestBySquashOutput.fromJson(jsonResponse.body);
}