Skip to content

Returns a structured, line-level diff between two blob versions in a repository

Description

Returns a structured, line-level diff between two blob versions in a repository. The diff is returned as an ordered list of hunks, where each hunk represents a contiguous run of changed lines together with any surrounding unchanged context lines.

Results are paginated. Use MaxResults and NextToken to retrieve additional pages.

For the typical usage workflow, see get_differences.

Usage

codecommit_get_blob_differences(repositoryName, afterBlobId,
  beforeBlobId, contextLines, ignoreWhitespace, MaxResults, NextToken)

Arguments

  • repositoryName

    [required] The name of the repository that contains the blobs to compare.

  • afterBlobId

    [required] The ID of the "after" (destination) blob in the diff. Typically the value of afterBlob.blobId from a Difference object returned by get_differences.

  • beforeBlobId

    The ID of the "before" (source) blob in the diff. Typically the value of beforeBlob.blobId from a Difference object returned by get_differences.

    If you do not specify a value, the operation returns a diff against an empty before-state. This is equivalent to treating the file as newly added.

  • contextLines

    The number of unchanged lines of context to include before and after each block of changes in a hunk. Valid values are 0 through 20. Defaults to 3.

  • ignoreWhitespace

    Specifies whether to ignore whitespace-only changes when computing the diff. When true, the operation treats lines that differ only in whitespace as unchanged. Defaults to false.

  • MaxResults

    The maximum number of DiffHunk entries to return in a single response page. Defaults to 100.

  • NextToken

    An enumeration token that returns the next batch of results when present in a request.

Value

A list with the following syntax:

list(
  hunks = list(
    list(
      beforeStartLine = 123,
      beforeLineCount = 123,
      afterStartLine = 123,
      afterLineCount = 123,
      changes = list(
        list(
          type = "CONTEXT"|"ADD"|"DELETE",
          beforeLineNumber = 123,
          afterLineNumber = 123,
          content = "string"
        )
      )
    )
  ),
  isBinary = TRUE|FALSE,
  beforeBlobSize = 123,
  afterBlobSize = 123,
  NextToken = "string"
)

Request syntax

svc$get_blob_differences(
  repositoryName = "string",
  afterBlobId = "string",
  beforeBlobId = "string",
  contextLines = 123,
  ignoreWhitespace = TRUE|FALSE,
  MaxResults = 123,
  NextToken = "string"
)