CodeCommit / Client / create_commit

create_commit#

CodeCommit.Client.create_commit(**kwargs)#

Creates a commit for a repository on the tip of a specified branch.

See also: AWS API Documentation

Request Syntax

response = client.create_commit(
    repositoryName='string',
    branchName='string',
    parentCommitId='string',
    authorName='string',
    email='string',
    commitMessage='string',
    keepEmptyFolders=True|False,
    putFiles=[
        {
            'filePath': 'string',
            'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK',
            'fileContent': b'bytes',
            'sourceFile': {
                'filePath': 'string',
                'isMove': True|False
            }
        },
    ],
    deleteFiles=[
        {
            'filePath': 'string'
        },
    ],
    setFileModes=[
        {
            'filePath': 'string',
            'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK'
        },
    ]
)
Parameters:
  • repositoryName (string) –

    [REQUIRED]

    The name of the repository where you create the commit.

  • branchName (string) –

    [REQUIRED]

    The name of the branch where you create the commit.

  • parentCommitId (string) – The ID of the commit that is the parent of the commit you create. Not required if this is an empty repository.

  • authorName (string) – The name of the author who created the commit. This information is used as both the author and committer for the commit.

  • email (string) – The email address of the person who created the commit.

  • commitMessage (string) – The commit message you want to include in the commit. Commit messages are limited to 256 KB. If no message is specified, a default message is used.

  • keepEmptyFolders (boolean) – If the commit contains deletions, whether to keep a folder or folder structure if the changes leave the folders empty. If true, a ..gitkeep file is created for empty folders. The default is false.

  • putFiles (list) –

    The files to add or update in this commit.

    • (dict) –

      Information about a file added or updated as part of a commit.

      • filePath (string) – [REQUIRED]

        The full path to the file in the repository, including the name of the file.

      • fileMode (string) –

        The extrapolated file mode permissions for the file. Valid values include EXECUTABLE and NORMAL.

      • fileContent (bytes) –

        The content of the file, if a source file is not specified.

      • sourceFile (dict) –

        The name and full path of the file that contains the changes you want to make as part of the commit, if you are not providing the file content directly.

        • filePath (string) – [REQUIRED]

          The full path to the file, including the name of the file.

        • isMove (boolean) –

          Whether to remove the source file from the parent commit.

  • deleteFiles (list) –

    The files to delete in this commit. These files still exist in earlier commits.

    • (dict) –

      A file that is deleted as part of a commit.

      • filePath (string) – [REQUIRED]

        The full path of the file to be deleted, including the name of the file.

  • setFileModes (list) –

    The file modes to update for files in this commit.

    • (dict) –

      Information about the file mode changes.

      • filePath (string) – [REQUIRED]

        The full path to the file, including the name of the file.

      • fileMode (string) – [REQUIRED]

        The file mode for the file.

Return type:

dict

Returns:

Response Syntax

{
    'commitId': 'string',
    'treeId': 'string',
    'filesAdded': [
        {
            'absolutePath': 'string',
            'blobId': 'string',
            'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK'
        },
    ],
    'filesUpdated': [
        {
            'absolutePath': 'string',
            'blobId': 'string',
            'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK'
        },
    ],
    'filesDeleted': [
        {
            'absolutePath': 'string',
            'blobId': 'string',
            'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK'
        },
    ]
}

Response Structure

  • (dict) –

    • commitId (string) –

      The full commit ID of the commit that contains your committed file changes.

    • treeId (string) –

      The full SHA-1 pointer of the tree information for the commit that contains the commited file changes.

    • filesAdded (list) –

      The files added as part of the committed file changes.

      • (dict) –

        A file to be added, updated, or deleted as part of a commit.

        • absolutePath (string) –

          The full path to the file to be added or updated, including the name of the file.

        • blobId (string) –

          The blob ID that contains the file information.

        • fileMode (string) –

          The extrapolated file mode permissions for the file. Valid values include EXECUTABLE and NORMAL.

    • filesUpdated (list) –

      The files updated as part of the commited file changes.

      • (dict) –

        A file to be added, updated, or deleted as part of a commit.

        • absolutePath (string) –

          The full path to the file to be added or updated, including the name of the file.

        • blobId (string) –

          The blob ID that contains the file information.

        • fileMode (string) –

          The extrapolated file mode permissions for the file. Valid values include EXECUTABLE and NORMAL.

    • filesDeleted (list) –

      The files deleted as part of the committed file changes.

      • (dict) –

        A file to be added, updated, or deleted as part of a commit.

        • absolutePath (string) –

          The full path to the file to be added or updated, including the name of the file.

        • blobId (string) –

          The blob ID that contains the file information.

        • fileMode (string) –

          The extrapolated file mode permissions for the file. Valid values include EXECUTABLE and NORMAL.

Exceptions

  • CodeCommit.Client.exceptions.RepositoryNameRequiredException

  • CodeCommit.Client.exceptions.InvalidRepositoryNameException

  • CodeCommit.Client.exceptions.RepositoryDoesNotExistException

  • CodeCommit.Client.exceptions.ParentCommitIdRequiredException

  • CodeCommit.Client.exceptions.InvalidParentCommitIdException

  • CodeCommit.Client.exceptions.ParentCommitDoesNotExistException

  • CodeCommit.Client.exceptions.ParentCommitIdOutdatedException

  • CodeCommit.Client.exceptions.BranchNameRequiredException

  • CodeCommit.Client.exceptions.InvalidBranchNameException

  • CodeCommit.Client.exceptions.BranchDoesNotExistException

  • CodeCommit.Client.exceptions.BranchNameIsTagNameException

  • CodeCommit.Client.exceptions.FileEntryRequiredException

  • CodeCommit.Client.exceptions.MaximumFileEntriesExceededException

  • CodeCommit.Client.exceptions.PutFileEntryConflictException

  • CodeCommit.Client.exceptions.SourceFileOrContentRequiredException

  • CodeCommit.Client.exceptions.FileContentAndSourceFileSpecifiedException

  • CodeCommit.Client.exceptions.PathRequiredException

  • CodeCommit.Client.exceptions.InvalidPathException

  • CodeCommit.Client.exceptions.SamePathRequestException

  • CodeCommit.Client.exceptions.FileDoesNotExistException

  • CodeCommit.Client.exceptions.FileContentSizeLimitExceededException

  • CodeCommit.Client.exceptions.FolderContentSizeLimitExceededException

  • CodeCommit.Client.exceptions.InvalidDeletionParameterException

  • CodeCommit.Client.exceptions.RestrictedSourceFileException

  • CodeCommit.Client.exceptions.FileModeRequiredException

  • CodeCommit.Client.exceptions.InvalidFileModeException

  • CodeCommit.Client.exceptions.NameLengthExceededException

  • CodeCommit.Client.exceptions.InvalidEmailException

  • CodeCommit.Client.exceptions.CommitMessageLengthExceededException

  • CodeCommit.Client.exceptions.EncryptionIntegrityChecksFailedException

  • CodeCommit.Client.exceptions.EncryptionKeyAccessDeniedException

  • CodeCommit.Client.exceptions.EncryptionKeyDisabledException

  • CodeCommit.Client.exceptions.EncryptionKeyNotFoundException

  • CodeCommit.Client.exceptions.EncryptionKeyUnavailableException

  • CodeCommit.Client.exceptions.NoChangeException

  • CodeCommit.Client.exceptions.FileNameConflictsWithDirectoryNameException

  • CodeCommit.Client.exceptions.DirectoryNameConflictsWithFileNameException

  • CodeCommit.Client.exceptions.FilePathConflictsWithSubmodulePathException