Skip to content

merge_branches_by_fast_forward

merge_branches_by_fast_forward(
    repository_name: RepositoryName,
    source_commit_specifier: CommitName,
    destination_commit_specifier: CommitName,
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
    target_branch: Optional[BranchName] = None,
) -> MergeBranchesByFastForwardOutput

Merges two branches using the fast-forward merge strategy.

Parameters:

  • repository_name (RepositoryName) –

    The name of the repository where you want to merge two branches.

  • source_commit_specifier (CommitName) –

    The branch, tag, HEAD, or other fully qualified reference used to identify a commit (for example, a branch name or a full commit ID).

  • destination_commit_specifier (CommitName) –

    The branch, tag, HEAD, or other fully qualified reference used to identify a commit (for example, a branch name or a full commit ID).

  • target_branch (Optional[BranchName], default: None ) –

    The branch where the merge is applied.

Raises:

Source code in docs_src/capo_codecommit/_services/code_commit.py
def merge_branches_by_fast_forward(
    self,
    repository_name: "capo_codecommit.types.repository_name.RepositoryName",
    source_commit_specifier: "capo_codecommit.types.commit_name.CommitName",
    destination_commit_specifier: "capo_codecommit.types.commit_name.CommitName",
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
    target_branch: Optional["capo_codecommit.types.branch_name.BranchName"] = None,
) -> "capo_codecommit.types.merge_branches_by_fast_forward_output.MergeBranchesByFastForwardOutput":
    """<p>Merges two branches using the fast-forward merge strategy.</p>

    Args:
        repository_name: <p>The name of the repository where you want to merge two branches.</p>
        source_commit_specifier: <p>The branch, tag, HEAD, or other fully qualified reference used to identify a commit (for example, a branch name or a full commit ID).</p>
        destination_commit_specifier: <p>The branch, tag, HEAD, or other fully qualified reference used to identify a commit (for example, a branch name or a full commit ID).</p>
        target_branch: <p>The branch where the merge is applied.</p>

    Raises:
        capo_codecommit.errors.branch_does_not_exist_exception.BranchDoesNotExistException: <p>The specified branch does not exist.</p>
        capo_codecommit.errors.branch_name_is_tag_name_exception.BranchNameIsTagNameException: <p>The specified branch name is not valid because it is a tag name. Enter the name of a branch in the repository. For a list of valid branch names, use <a>ListBranches</a>.</p>
        capo_codecommit.errors.branch_name_required_exception.BranchNameRequiredException: <p>A branch name is required, but was not specified.</p>
        capo_codecommit.errors.commit_does_not_exist_exception.CommitDoesNotExistException: <p>The specified commit does not exist or no commit was specified, and the specified repository has no default branch.</p>
        capo_codecommit.errors.commit_required_exception.CommitRequiredException: <p>A commit was not specified.</p>
        capo_codecommit.errors.concurrent_reference_update_exception.ConcurrentReferenceUpdateException: <p>The merge cannot be completed because the target branch has been modified. Another user might have modified the target branch while the merge was in progress. Wait a few minutes, and then try again.</p>
        capo_codecommit.errors.encryption_integrity_checks_failed_exception.EncryptionIntegrityChecksFailedException: <p>An encryption integrity check failed.</p>
        capo_codecommit.errors.encryption_key_access_denied_exception.EncryptionKeyAccessDeniedException: <p>An encryption key could not be accessed.</p>
        capo_codecommit.errors.encryption_key_disabled_exception.EncryptionKeyDisabledException: <p>The encryption key is disabled.</p>
        capo_codecommit.errors.encryption_key_not_found_exception.EncryptionKeyNotFoundException: <p>No encryption key was found.</p>
        capo_codecommit.errors.encryption_key_unavailable_exception.EncryptionKeyUnavailableException: <p>The encryption key is not available.</p>
        capo_codecommit.errors.invalid_branch_name_exception.InvalidBranchNameException: <p>The specified reference name is not valid.</p>
        capo_codecommit.errors.invalid_commit_exception.InvalidCommitException: <p>The specified commit is not valid.</p>
        capo_codecommit.errors.invalid_repository_name_exception.InvalidRepositoryNameException: <p>A specified repository name is not valid.</p> <note> <p>This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.</p> </note>
        capo_codecommit.errors.invalid_target_branch_exception.InvalidTargetBranchException: <p>The specified target branch is not valid.</p>
        capo_codecommit.errors.manual_merge_required_exception.ManualMergeRequiredException: <p>The pull request cannot be merged automatically into the destination branch. You must manually merge the branches and resolve any conflicts.</p>
        capo_codecommit.errors.repository_does_not_exist_exception.RepositoryDoesNotExistException: <p>The specified repository does not exist.</p>
        capo_codecommit.errors.repository_name_required_exception.RepositoryNameRequiredException: <p>A repository name is required, but was not specified.</p>
        capo_codecommit.errors.tips_divergence_exceeded_exception.TipsDivergenceExceededException: <p>The divergence between the tips of the provided commit specifiers is too great to determine whether there might be any merge conflicts. Locally compare the specifiers using <code>git diff</code> or a diff tool.</p>
        capo_codecommit.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codecommit.types.merge_branches_by_fast_forward_input.MergeBranchesByFastForwardInput]",
    ) -> OperationResponse[
        "capo_codecommit.types.merge_branches_by_fast_forward_output.MergeBranchesByFastForwardOutput"
    ]:
        import capo_codecommit._operations.code_commit_20150413.merge_branches_by_fast_forward

        output, http_response = (
            capo_codecommit._operations.code_commit_20150413.merge_branches_by_fast_forward.merge_branches_by_fast_forward(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("MergeBranchesByFastForward")
    )
    input_: capo_codecommit.types.merge_branches_by_fast_forward_input.MergeBranchesByFastForwardInput = {
        "repository_name": repository_name,
        "source_commit_specifier": source_commit_specifier,
        "destination_commit_specifier": destination_commit_specifier,
    }
    if target_branch is not None:
        input_["target_branch"] = target_branch

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output