ListFileCommitHistoryCommand

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

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CodeCommitClient, ListFileCommitHistoryCommand } from "@aws-sdk/client-codecommit"; // ES Modules import
// const { CodeCommitClient, ListFileCommitHistoryCommand } = require("@aws-sdk/client-codecommit"); // CommonJS import
const client = new CodeCommitClient(config);
const input = { // ListFileCommitHistoryRequest
  repositoryName: "STRING_VALUE", // required
  commitSpecifier: "STRING_VALUE",
  filePath: "STRING_VALUE", // required
  maxResults: Number("int"),
  nextToken: "STRING_VALUE",
};
const command = new ListFileCommitHistoryCommand(input);
const response = await client.send(command);
// { // ListFileCommitHistoryResponse
//   revisionDag: [ // RevisionDag // required
//     { // FileVersion
//       commit: { // Commit
//         commitId: "STRING_VALUE",
//         treeId: "STRING_VALUE",
//         parents: [ // ParentList
//           "STRING_VALUE",
//         ],
//         message: "STRING_VALUE",
//         author: { // UserInfo
//           name: "STRING_VALUE",
//           email: "STRING_VALUE",
//           date: "STRING_VALUE",
//         },
//         committer: {
//           name: "STRING_VALUE",
//           email: "STRING_VALUE",
//           date: "STRING_VALUE",
//         },
//         additionalData: "STRING_VALUE",
//       },
//       blobId: "STRING_VALUE",
//       path: "STRING_VALUE",
//       revisionChildren: [ // RevisionChildren
//         "STRING_VALUE",
//       ],
//     },
//   ],
//   nextToken: "STRING_VALUE",
// };

ListFileCommitHistoryCommand Input

Parameter
Type
Description
filePath
Required
string | undefined

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

repositoryName
Required
string | undefined

The name of the repository that contains the file.

commitSpecifier
string | undefined

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.

maxResults
number | undefined

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

nextToken
string | undefined

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

ListFileCommitHistoryCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
revisionDag
Required
FileVersion[] | undefined

An array of FileVersion objects that form a directed acyclic graph (DAG) of the changes to the file made by the commits that changed the file.

nextToken
string | undefined

An enumeration token that can be used to return the next batch of results.

Throws

Name
Fault
Details
CommitDoesNotExistException
client

The specified commit does not exist or no commit was specified, and the specified repository has no default branch.

CommitRequiredException
client

A commit was not specified.

EncryptionIntegrityChecksFailedException
server

An encryption integrity check failed.

EncryptionKeyAccessDeniedException
client

An encryption key could not be accessed.

EncryptionKeyDisabledException
client

The encryption key is disabled.

EncryptionKeyNotFoundException
client

No encryption key was found.

EncryptionKeyUnavailableException
client

The encryption key is not available.

InvalidCommitException
client

The specified commit is not valid.

InvalidContinuationTokenException
client

The specified continuation token is not valid.

InvalidMaxResultsException
client

The specified number of maximum results is not valid.

InvalidRepositoryNameException
client

A specified repository name is not valid.

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.

RepositoryDoesNotExistException
client

The specified repository does not exist.

RepositoryNameRequiredException
client

A repository name is required, but was not specified.

TipsDivergenceExceededException
client

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 git diff or a diff tool.

CodeCommitServiceException
Base exception class for all service exceptions from CodeCommit service.