GetBlobDifferences
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 GetDifferences.
Request Syntax
{
"afterBlobId": "string",
"beforeBlobId": "string",
"contextLines": number,
"ignoreWhitespace": boolean,
"MaxResults": number,
"NextToken": "string",
"repositoryName": "string"
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- afterBlobId
-
The ID of the "after" (destination) blob in the diff. Typically the value of
afterBlob.blobIdfrom aDifferenceobject returned by GetDifferences.Type: String
Required: Yes
- beforeBlobId
-
The ID of the "before" (source) blob in the diff. Typically the value of
beforeBlob.blobIdfrom aDifferenceobject returned by GetDifferences.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.
Type: String
Required: No
- 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.Type: Integer
Required: No
- 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 tofalse.Type: Boolean
Required: No
- MaxResults
-
The maximum number of
DiffHunkentries to return in a single response page. Defaults to100.Type: Integer
Required: No
- NextToken
-
An enumeration token that returns the next batch of results when present in a request.
Type: String
Required: No
- repositoryName
-
The name of the repository that contains the blobs to compare.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 100.
Pattern:
[\w\.-]+Required: Yes
Response Syntax
{
"afterBlobSize": number,
"beforeBlobSize": number,
"hunks": [
{
"afterLineCount": number,
"afterStartLine": number,
"beforeLineCount": number,
"beforeStartLine": number,
"changes": [
{
"afterLineNumber": number,
"beforeLineNumber": number,
"content": "string",
"type": "string"
}
]
}
],
"isBinary": boolean,
"NextToken": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- afterBlobSize
-
The size, in bytes, of the blob identified by
afterBlobId.Type: Long
- beforeBlobSize
-
The size, in bytes, of the blob identified by
beforeBlobId. Returns0when you do not specifybeforeBlobId.Type: Long
- hunks
-
An ordered list of diff hunks. Each hunk represents a contiguous run of changed and adjacent context lines. The list is empty when the blobs are identical or when the content is binary. The list is also empty when a paginated request has already returned all hunks in earlier pages, in which case
NextTokenis alsonull.Type: Array of DiffHunk objects
Array Members: Maximum number of 1000 items.
- isBinary
-
Specifies whether the operation treated the diff content as binary. When
true, the operation does not compute a line-level diff andhunksis empty.Type: Boolean
- NextToken
-
An enumeration token that can be used in a request to return the next batch of
DiffHunkentries.nullwhen the response contains the final page of the diff.Type: String
Errors
For information about the errors that are common to all actions, see Common Error Types.
- BlobIdDoesNotExistException
-
The specified blob does not exist.
HTTP Status Code: 400
- BlobIdRequiredException
-
A blob ID is required, but was not specified.
HTTP Status Code: 400
- EncryptionIntegrityChecksFailedException
-
An encryption integrity check failed.
HTTP Status Code: 500
- EncryptionKeyAccessDeniedException
-
An encryption key could not be accessed.
HTTP Status Code: 400
- EncryptionKeyDisabledException
-
The encryption key is disabled.
HTTP Status Code: 400
- EncryptionKeyNotFoundException
-
No encryption key was found.
HTTP Status Code: 400
- EncryptionKeyUnavailableException
-
The encryption key is not available.
HTTP Status Code: 400
- FileTooLargeException
-
The specified file exceeds the file size limit for AWS CodeCommit. For more information about limits in AWS CodeCommit, see Quotas in the AWS CodeCommit User Guide.
HTTP Status Code: 400
- InvalidBlobIdException
-
The specified blob is not valid.
HTTP Status Code: 400
- InvalidContinuationTokenException
-
The specified continuation token is not valid.
HTTP Status Code: 400
- InvalidMaxResultsException
-
The specified number of maximum results is not valid.
HTTP Status Code: 400
- InvalidRepositoryNameException
-
A specified repository name is not valid.
Note
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.
HTTP Status Code: 400
- RepositoryDoesNotExistException
-
The specified repository does not exist.
HTTP Status Code: 400
- RepositoryNameRequiredException
-
A repository name is required, but was not specified.
HTTP Status Code: 400
- ValidationException
-
The specified input is either not valid, or it could not be validated.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: