mergeBranchesByFastForward method

Future<MergeBranchesByFastForwardOutput> mergeBranchesByFastForward({
  1. required String destinationCommitSpecifier,
  2. required String repositoryName,
  3. required String sourceCommitSpecifier,
  4. String? targetBranch,
})

Merges two branches using the fast-forward 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 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 targetBranch : The branch where the merge is applied.

Implementation

Future<MergeBranchesByFastForwardOutput> mergeBranchesByFastForward({
  required String destinationCommitSpecifier,
  required String repositoryName,
  required String sourceCommitSpecifier,
  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.MergeBranchesByFastForward'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'destinationCommitSpecifier': destinationCommitSpecifier,
      'repositoryName': repositoryName,
      'sourceCommitSpecifier': sourceCommitSpecifier,
      if (targetBranch != null) 'targetBranch': targetBranch,
    },
  );

  return MergeBranchesByFastForwardOutput.fromJson(jsonResponse.body);
}