getMergeOptions method

Future<GetMergeOptionsOutput> getMergeOptions({
  1. required String destinationCommitSpecifier,
  2. required String repositoryName,
  3. required String sourceCommitSpecifier,
  4. ConflictDetailLevelTypeEnum? conflictDetailLevel,
  5. ConflictResolutionStrategyTypeEnum? conflictResolutionStrategy,
})

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.

May throw RepositoryNameRequiredException. May throw InvalidRepositoryNameException. May throw RepositoryDoesNotExistException. May throw CommitRequiredException. May throw CommitDoesNotExistException. May throw InvalidCommitException. May throw TipsDivergenceExceededException. May throw InvalidConflictDetailLevelException. May throw InvalidConflictResolutionStrategyException. May throw MaximumFileContentToLoadExceededException. May throw MaximumItemsToCompareExceededException. 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 that contains the commits about which you want to get merge options.

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 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 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.

Implementation

Future<GetMergeOptionsOutput> getMergeOptions({
  required String destinationCommitSpecifier,
  required String repositoryName,
  required String sourceCommitSpecifier,
  ConflictDetailLevelTypeEnum? conflictDetailLevel,
  ConflictResolutionStrategyTypeEnum? conflictResolutionStrategy,
}) async {
  ArgumentError.checkNotNull(
      destinationCommitSpecifier, 'destinationCommitSpecifier');
  ArgumentError.checkNotNull(repositoryName, 'repositoryName');
  _s.validateStringLength(
    'repositoryName',
    repositoryName,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(sourceCommitSpecifier, 'sourceCommitSpecifier');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeCommit_20150413.GetMergeOptions'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'destinationCommitSpecifier': destinationCommitSpecifier,
      'repositoryName': repositoryName,
      'sourceCommitSpecifier': sourceCommitSpecifier,
      if (conflictDetailLevel != null)
        'conflictDetailLevel': conflictDetailLevel.toValue(),
      if (conflictResolutionStrategy != null)
        'conflictResolutionStrategy': conflictResolutionStrategy.toValue(),
    },
  );

  return GetMergeOptionsOutput.fromJson(jsonResponse.body);
}