createUnreferencedMergeCommit method

Future<CreateUnreferencedMergeCommitOutput> createUnreferencedMergeCommit({
  1. required String destinationCommitSpecifier,
  2. required MergeOptionTypeEnum mergeOption,
  3. required String repositoryName,
  4. required String sourceCommitSpecifier,
  5. String? authorName,
  6. String? commitMessage,
  7. ConflictDetailLevelTypeEnum? conflictDetailLevel,
  8. ConflictResolution? conflictResolution,
  9. ConflictResolutionStrategyTypeEnum? conflictResolutionStrategy,
  10. String? email,
  11. bool? keepEmptyFolders,
})

Creates an unreferenced commit that represents the result of merging two branches using a specified merge strategy. This can help you determine the outcome of a potential merge. This API cannot be used with the fast-forward merge strategy because that strategy does not create a merge commit.

May throw CommitDoesNotExistException. May throw CommitMessageLengthExceededException. May throw CommitRequiredException. May throw ConcurrentReferenceUpdateException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException. May throw FileContentSizeLimitExceededException. May throw FileModeRequiredException. May throw FolderContentSizeLimitExceededException. May throw InvalidCommitException. May throw InvalidConflictDetailLevelException. May throw InvalidConflictResolutionException. May throw InvalidConflictResolutionStrategyException. May throw InvalidEmailException. May throw InvalidFileModeException. May throw InvalidMergeOptionException. May throw InvalidPathException. May throw InvalidReplacementContentException. May throw InvalidReplacementTypeException. May throw InvalidRepositoryNameException. May throw ManualMergeRequiredException. May throw MaximumConflictResolutionEntriesExceededException. May throw MaximumFileContentToLoadExceededException. May throw MaximumItemsToCompareExceededException. May throw MergeOptionRequiredException. May throw MultipleConflictResolutionEntriesException. May throw NameLengthExceededException. May throw PathRequiredException. May throw ReplacementContentRequiredException. May throw ReplacementTypeRequiredException. May throw RepositoryDoesNotExistException. May throw RepositoryNameRequiredException. May throw TipsDivergenceExceededException.

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 mergeOption : The merge option or strategy you want to use to merge the code.

Parameter repositoryName : The name of the repository where you want to create the unreferenced merge commit.

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 unreferenced commit. This information is used as both the author and committer for the commit.

Parameter commitMessage : The commit message for the unreferenced commit.

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 for the person who created the unreferenced commit.

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.

Implementation

Future<CreateUnreferencedMergeCommitOutput> createUnreferencedMergeCommit({
  required String destinationCommitSpecifier,
  required MergeOptionTypeEnum mergeOption,
  required String repositoryName,
  required String sourceCommitSpecifier,
  String? authorName,
  String? commitMessage,
  ConflictDetailLevelTypeEnum? conflictDetailLevel,
  ConflictResolution? conflictResolution,
  ConflictResolutionStrategyTypeEnum? conflictResolutionStrategy,
  String? email,
  bool? keepEmptyFolders,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeCommit_20150413.CreateUnreferencedMergeCommit'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'destinationCommitSpecifier': destinationCommitSpecifier,
      'mergeOption': mergeOption.value,
      'repositoryName': repositoryName,
      'sourceCommitSpecifier': sourceCommitSpecifier,
      if (authorName != null) 'authorName': authorName,
      if (commitMessage != null) 'commitMessage': commitMessage,
      if (conflictDetailLevel != null)
        'conflictDetailLevel': conflictDetailLevel.value,
      if (conflictResolution != null)
        'conflictResolution': conflictResolution,
      if (conflictResolutionStrategy != null)
        'conflictResolutionStrategy': conflictResolutionStrategy.value,
      if (email != null) 'email': email,
      if (keepEmptyFolders != null) 'keepEmptyFolders': keepEmptyFolders,
    },
  );

  return CreateUnreferencedMergeCommitOutput.fromJson(jsonResponse.body);
}