Skip to content

list_file_commit_history

list_file_commit_history(
    repository_name: RepositoryName,
    file_path: Path,
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
    commit_specifier: Optional[CommitName] = None,
    max_results: Optional[Limit] = None,
    next_token: Optional[NextToken] = None,
) -> ListFileCommitHistoryResponse

Retrieves a list of commits and changes to a specified file.

Parameters:

  • repository_name (RepositoryName) –

    The name of the repository that contains the file.

  • commit_specifier (Optional[CommitName], default: None ) –

    The fully quaified reference that identifies the commit that contains the file. For example, you can specify a full commit ID, a tag, a branch name, or a reference such as refs/heads/main. If none is provided, the head commit is used.

  • file_path (Path) –

    The full path of the file whose history you want to retrieve, including the name of the file.

  • max_results (Optional[Limit], default: None ) –

    A non-zero, non-negative integer used to limit the number of returned results.

  • next_token (Optional[NextToken], default: None ) –

    An enumeration token that allows the operation to batch the results.

Raises:

Source code in docs_src/capo_codecommit/_services/code_commit.py
def list_file_commit_history(
    self,
    repository_name: "capo_codecommit.types.repository_name.RepositoryName",
    file_path: "capo_codecommit.types.path.Path",
    *,
    config_overrides: Optional[CodeCommitClientConfig] = None,
    commit_specifier: Optional[
        "capo_codecommit.types.commit_name.CommitName"
    ] = None,
    max_results: Optional["capo_codecommit.types.limit.Limit"] = None,
    next_token: Optional["capo_codecommit.types.next_token.NextToken"] = None,
) -> "capo_codecommit.types.list_file_commit_history_response.ListFileCommitHistoryResponse":
    """<p>Retrieves a list of commits and changes to a specified file.</p>

    Args:
        repository_name: <p>The name of the repository that contains the file.</p>
        commit_specifier: <p>The fully quaified reference that identifies the commit that contains the file. For example, you can specify a full commit ID, a tag, a branch name, or a reference such as <code>refs/heads/main</code>. If none is provided, the head commit is used.</p>
        file_path: <p>The full path of the file whose history you want to retrieve, including the name of the file.</p>
        max_results: <p>A non-zero, non-negative integer used to limit the number of returned results.</p>
        next_token: <p>An enumeration token that allows the operation to batch the results.</p>

    Raises:
        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.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_commit_exception.InvalidCommitException: <p>The specified commit is not valid.</p>
        capo_codecommit.errors.invalid_continuation_token_exception.InvalidContinuationTokenException: <p>The specified continuation token is not valid.</p>
        capo_codecommit.errors.invalid_max_results_exception.InvalidMaxResultsException: <p>The specified number of maximum results 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.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.list_file_commit_history_request.ListFileCommitHistoryRequest]",
    ) -> OperationResponse[
        "capo_codecommit.types.list_file_commit_history_response.ListFileCommitHistoryResponse"
    ]:
        import capo_codecommit._operations.code_commit_20150413.list_file_commit_history

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListFileCommitHistory")
    )
    input_: capo_codecommit.types.list_file_commit_history_request.ListFileCommitHistoryRequest = {
        "repository_name": repository_name,
        "file_path": file_path,
    }
    if commit_specifier is not None:
        input_["commit_specifier"] = commit_specifier
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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