mergeBranchesBySquash method
- required String destinationCommitSpecifier,
- required String repositoryName,
- required String sourceCommitSpecifier,
- String? authorName,
- String? commitMessage,
- ConflictDetailLevelTypeEnum? conflictDetailLevel,
- ConflictResolution? conflictResolution,
- ConflictResolutionStrategyTypeEnum? conflictResolutionStrategy,
- String? email,
- bool? keepEmptyFolders,
- String? targetBranch,
Merges two branches using the squash merge strategy.
May throw RepositoryNameRequiredException. May throw InvalidRepositoryNameException. May throw RepositoryDoesNotExistException. May throw TipsDivergenceExceededException. May throw CommitRequiredException. May throw InvalidCommitException. May throw CommitDoesNotExistException. May throw InvalidTargetBranchException. May throw InvalidBranchNameException. May throw BranchNameRequiredException. May throw BranchNameIsTagNameException. May throw BranchDoesNotExistException. May throw ManualMergeRequiredException. May throw InvalidConflictDetailLevelException. May throw InvalidConflictResolutionStrategyException. May throw InvalidConflictResolutionException. May throw MaximumConflictResolutionEntriesExceededException. May throw MultipleConflictResolutionEntriesException. May throw ReplacementTypeRequiredException. May throw InvalidReplacementTypeException. May throw ReplacementContentRequiredException. May throw InvalidReplacementContentException. May throw PathRequiredException. May throw InvalidPathException. May throw FileContentSizeLimitExceededException. May throw FolderContentSizeLimitExceededException. May throw MaximumFileContentToLoadExceededException. May throw MaximumItemsToCompareExceededException. May throw FileModeRequiredException. May throw InvalidFileModeException. May throw NameLengthExceededException. May throw InvalidEmailException. May throw CommitMessageLengthExceededException. May throw ConcurrentReferenceUpdateException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.
Parameter destinationCommitSpecifier
:
The branch, tag, HEAD, or other fully qualified reference used to identify
a commit (for example, a branch name or a full commit ID).
Parameter repositoryName
:
The name of the repository where you want to merge two branches.
Parameter sourceCommitSpecifier
:
The branch, tag, HEAD, or other fully qualified reference used to identify
a commit (for example, a branch name or a full commit ID).
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 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 this is specified as
true, a .gitkeep file is created for empty folders. The default is false.
Parameter targetBranch
:
The branch where the merge is applied.
Implementation
Future<MergeBranchesBySquashOutput> mergeBranchesBySquash({
required String destinationCommitSpecifier,
required String repositoryName,
required String sourceCommitSpecifier,
String? authorName,
String? commitMessage,
ConflictDetailLevelTypeEnum? conflictDetailLevel,
ConflictResolution? conflictResolution,
ConflictResolutionStrategyTypeEnum? conflictResolutionStrategy,
String? email,
bool? keepEmptyFolders,
String? targetBranch,
}) async {
ArgumentError.checkNotNull(
destinationCommitSpecifier, 'destinationCommitSpecifier');
ArgumentError.checkNotNull(repositoryName, 'repositoryName');
_s.validateStringLength(
'repositoryName',
repositoryName,
1,
100,
isRequired: true,
);
ArgumentError.checkNotNull(sourceCommitSpecifier, 'sourceCommitSpecifier');
_s.validateStringLength(
'targetBranch',
targetBranch,
1,
256,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CodeCommit_20150413.MergeBranchesBySquash'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'destinationCommitSpecifier': destinationCommitSpecifier,
'repositoryName': repositoryName,
'sourceCommitSpecifier': sourceCommitSpecifier,
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 (targetBranch != null) 'targetBranch': targetBranch,
},
);
return MergeBranchesBySquashOutput.fromJson(jsonResponse.body);
}