AWS CodeCommit

2019/02/20 - AWS CodeCommit - 1 new api methods

Changes  Update codecommit client to latest version

CreateCommit (new) Link ΒΆ

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

See also: AWS API Documentation

Request Syntax

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'
        },
    ]
)
type repositoryName:

string

param repositoryName:

[REQUIRED]

The name of the repository where you will create the commit.

type branchName:

string

param branchName:

[REQUIRED]

The name of the branch where you will create the commit.

type parentCommitId:

string

param parentCommitId:

The ID of the commit that is the parent of the commit you will create. If this is an empty repository, this is not required.

type authorName:

string

param authorName:

The name of the author who created the commit. This information will be used as both the author and committer for the commit.

type email:

string

param email:

The email address of the person who created the commit.

type commitMessage:

string

param commitMessage:

The commit message you want to include as part of creating the commit. Commit messages are limited to 256 KB. If no message is specified, a default message will be used.

type keepEmptyFolders:

boolean

param keepEmptyFolders:

If the commit contains deletions, whether to keep a folder or folder structure if the changes leave the folders empty. If this is specified as true, a .gitkeep file will be created for empty folders.

type putFiles:

list

param putFiles:

The files to add or update in this commit.

  • (dict) --

    Information about a file that will be 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.

type deleteFiles:

list

param deleteFiles:

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

  • (dict) --

    A file that will be deleted as part of a commit.

    • filePath (string) -- [REQUIRED]

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

type setFileModes:

list

param setFileModes:

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.

rtype:

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 that will be added, updated, or deleted as part of a commit.

        • absolutePath (string) --

          The full path to the file that will 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 that will be added, updated, or deleted as part of a commit.

        • absolutePath (string) --

          The full path to the file that will 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 that will be added, updated, or deleted as part of a commit.

        • absolutePath (string) --

          The full path to the file that will 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.