Skip to content

/AWS1/IF_CMT=>GETBLOBDIFFERENCES()

About 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.

Method Signature

METHODS /AWS1/IF_CMT~GETBLOBDIFFERENCES
  IMPORTING
    !IV_REPOSITORYNAME TYPE /AWS1/CMTREPOSITORYNAME OPTIONAL
    !IV_AFTERBLOBID TYPE /AWS1/CMTOBJECTID OPTIONAL
    !IV_BEFOREBLOBID TYPE /AWS1/CMTOBJECTID OPTIONAL
    !IV_CONTEXTLINES TYPE /AWS1/CMTDIFFCONTEXT OPTIONAL
    !IV_IGNOREWHITESPACE TYPE /AWS1/CMTIGNOREWHITESPACES OPTIONAL
    !IV_MAXRESULTS TYPE /AWS1/CMTLIMIT OPTIONAL
    !IV_NEXTTOKEN TYPE /AWS1/CMTNEXTTOKEN OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_cmtgetblobdifrncsout
  RAISING
    /AWS1/CX_CMTBLOBIDDOESNOTEXEX
    /AWS1/CX_CMTBLOBIDREQUIREDEX
    /AWS1/CX_CMTENCINTEGRITYCHXF00
    /AWS1/CX_CMTENCKEYACCDENIEDEX
    /AWS1/CX_CMTENCKEYDISABLEDEX
    /AWS1/CX_CMTENCKEYNOTFOUNDEX
    /AWS1/CX_CMTENCKEYUNAVAILEX
    /AWS1/CX_CMTFILETOOLARGEEX
    /AWS1/CX_CMTINVALIDBLOBIDEX
    /AWS1/CX_CMTINVCONTINUATIONT00
    /AWS1/CX_CMTINVMAXRESULTSEX
    /AWS1/CX_CMTINVREPOSITORYNAM00
    /AWS1/CX_CMTREPOSITORYDOESNO00
    /AWS1/CX_CMTREPOSITORYNAMERE00
    /AWS1/CX_CMTVLDTNEXCEPTION
    /AWS1/CX_CMTCLIENTEXC
    /AWS1/CX_CMTSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_repositoryname TYPE /AWS1/CMTREPOSITORYNAME /AWS1/CMTREPOSITORYNAME

The name of the repository that contains the blobs to compare.

iv_afterblobid TYPE /AWS1/CMTOBJECTID /AWS1/CMTOBJECTID

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

Optional arguments:

iv_beforeblobid TYPE /AWS1/CMTOBJECTID /AWS1/CMTOBJECTID

The ID of the "before" (source) blob in the diff. Typically the value of beforeBlob.blobId from a Difference object 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.

iv_contextlines TYPE /AWS1/CMTDIFFCONTEXT /AWS1/CMTDIFFCONTEXT

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.

iv_ignorewhitespace TYPE /AWS1/CMTIGNOREWHITESPACES /AWS1/CMTIGNOREWHITESPACES

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.

iv_maxresults TYPE /AWS1/CMTLIMIT /AWS1/CMTLIMIT

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

iv_nexttoken TYPE /AWS1/CMTNEXTTOKEN /AWS1/CMTNEXTTOKEN

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

RETURNING

oo_output TYPE REF TO /aws1/cl_cmtgetblobdifrncsout /AWS1/CL_CMTGETBLOBDIFRNCSOUT

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->getblobdifferences(
  iv_afterblobid = |string|
  iv_beforeblobid = |string|
  iv_contextlines = 123
  iv_ignorewhitespace = ABAP_TRUE
  iv_maxresults = 123
  iv_nexttoken = |string|
  iv_repositoryname = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_hunks( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_linenumber = lo_row_1->get_beforestartline( ).
      lv_count = lo_row_1->get_beforelinecount( ).
      lv_linenumber = lo_row_1->get_afterstartline( ).
      lv_count = lo_row_1->get_afterlinecount( ).
      LOOP AT lo_row_1->get_changes( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_diffchangetype = lo_row_3->get_type( ).
          lv_linenumber = lo_row_3->get_beforelinenumber( ).
          lv_linenumber = lo_row_3->get_afterlinenumber( ).
          lv_linecontent = lo_row_3->get_content( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
  lv_capitalboolean = lo_result->get_isbinary( ).
  lv_objectsize = lo_result->get_beforeblobsize( ).
  lv_objectsize = lo_result->get_afterblobsize( ).
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.