GetMergeRequestChangeTree

Updated at:

Retrieves diff statistics for a merge request, including a file change tree, total added and deleted lines, and per-file line change statistics.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

GET /api/v4/projects/merge_requests/diffs/change_tree HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

organizationId

string

Yes

The ID of the organization. Find this ID in the URL of Alibaba Cloud DevOps: https://devops.aliyun.com/organization/<organizationId>.

5ebbc0228123212b59xxxxx

accessToken

string

No

The personal access token. Not required if authenticating with an Alibaba Cloud AccessKey pair (AK/SK) or Security Token Service (STS).

f0b1e61db5961df5975a93f9129d2513

repositoryIdentity

string

Yes

The ID or full path of the repository.

2835387 或 codeup/codeup-demo

localId

integer

Yes

The local ID of the merge request within its repository.

7

fromPatchSetBizId

string

Yes

The business ID of the patch set for the merge target.

Note

In APIs related to merge requests and comparisons, from and to may seem counterintuitive. from specifies the merge target, and to specifies the merge source. This order aligns with the execution sequence of a native Git command. The source and target labels in the UI are adjusted for clarity.

5e733626d53f4b04a6aa0e23d4ff72b8

toPatchSetBizId

string

Yes

The business ID of the patch set for the merge source.

Note

In APIs related to merge requests and comparisons, from and to may seem counterintuitive. from specifies the merge target, and to specifies the merge source. This order aligns with the execution sequence of a native Git command. The source and target labels in the UI are adjusted for clarity.

513fcfd81a9142d2bb0db4f72c0aa15b

Response elements

Element

Type

Description

Example

object

The response object.

requestId

string

The unique identifier for the request, useful for troubleshooting.

HC93CE1A-8D7A-13A9-8306-7465DE2E5C0F

success

boolean

Indicates whether the request was successful.

true

errorCode

string

The error code returned if the request fails.

SYSTEM_UNKNOWN_ERROR

errorMessage

string

The error message that provides details about a failed request.

""

result

object

The returned result.

changedFilesCount

integer

The total number of changed files.

20

totalAddLines

integer

The total number of added lines.

100

totalDelLines

integer

The total number of deleted lines.

50

changedFilesInfos

array<object>

An array of objects, each containing information about a changed file.

object

An object containing statistics for a single changed file.

newPath

string

The new path of the file.

test.txt

oldPath

string

The old path of the file.

test.txt

newFile

boolean

Whether the file is new.

true

renamedFile

boolean

Whether the file was renamed.

false

deletedFile

boolean

Whether the file was deleted.

false

binaryFile

boolean

Whether the file is a binary file.

false

addLines

integer

The number of added lines in the file.

10

delLines

integer

The number of deleted lines in the file.

0

Examples

Success response

JSON format

{
  "requestId": "HC93CE1A-8D7A-13A9-8306-7465DE2E5C0F",
  "success": true,
  "errorCode": "SYSTEM_UNKNOWN_ERROR",
  "errorMessage": "\"\"",
  "result": {
    "changedFilesCount": 20,
    "totalAddLines": 100,
    "totalDelLines": 50,
    "changedFilesInfos": [
      {
        "newPath": "test.txt",
        "oldPath": "test.txt",
        "newFile": true,
        "renamedFile": false,
        "deletedFile": false,
        "binaryFile": false,
        "addLines": 10,
        "delLines": 0
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.