GetCompareDetail
Compares two commits (branches and tags are essentially commits) and returns a list of commits between them along with the diff content, from which the file change tree can be retrieved.
Try it now
Test
RAM authorization
Request syntax
GET /repository/{repositoryId}/commits/compare/detail HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| repositoryId |
integer |
Yes |
The repository ID. |
2369234 |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| organizationId |
string |
Yes |
The enterprise identifier, also known as the enterprise ID. It is a string that can be obtained from the Yunxiao URL, such as https://devops.aliyun.com/organization/[OrganizationId]. |
5ebbc0228123212b59xxxxx |
| from |
string |
Yes |
The starting commit ID. |
c9fb781f3d66ef6ee60bdd5c414f5106454b1426 |
| to |
string |
Yes |
The ending commit ID. |
b8f6f28520b1936aafe2e638373e19ccafa42b02 |
| mergeBase |
boolean |
No |
Specifies whether to use merge-base for comparison. |
false |
| maxDiffFile |
integer |
No |
The maximum number of files to return. Note
The maximum number of files that can be securely returned is limited to 5,000. |
5000 |
| maxDiffByte |
integer |
No |
The maximum number of diff bytes to return. Note
The maximum number of bytes that can be returned is limited to 24 MB. |
25165824 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| requestId |
string |
The request ID. |
ASSDS-ASSASX-XSAXSA-XSAXSAXS |
| errorCode |
string |
The error code. |
SYSTEM_UNKNOWN_ERROR |
| errorMessage |
string |
The error message. |
"" |
| success |
boolean |
Indicates whether the call was successful. |
true |
| result |
object |
The returned result. |
|
| messages |
array |
The list of messages. |
|
|
string |
The message content. |
"" |
|
| commits |
array<object> |
The list of commits. |
|
|
array<object> |
The commit details. |
||
| id |
string |
The commit ID. |
b8f6f28520b1936aafe2e638373e19ccafa42b02 |
| shortId |
string |
The short commit ID. |
b8f6f285 |
| title |
string |
The commit title, which is the first line of the commit message. |
Commit title |
| message |
string |
The commit details. |
"" |
| authorName |
string |
The name of the author. |
Yunxiao Codeup |
| authorEmail |
string |
The email address of the author. |
username@example.com |
| authoredDate |
string |
The time when the commit was authored. |
2023-01-03T15:41:26+08:00 |
| createdAt |
string |
The creation time. |
2023-01-03T15:41:26+08:00 |
| committerName |
string |
The name of the committer. |
Yunxiao CodeupCommitter |
| committerEmail |
string |
The email address of the committer. |
username@example.com |
| committedDate |
string |
The time when the committer made the commit. |
2023-01-03T15:41:26+08:00 |
| parentIds |
array |
The parent commit IDs. |
|
|
string |
The parent commit ID. |
c9fb781f3d66ef6ee60bdd5c414f5106454b1426 |
|
| author |
object |
The author information. |
|
| id |
integer |
The Codeup user ID. |
21396 |
| name |
string |
The user name. |
Yunxiao |
| username |
string |
The user nickname. |
Codeup |
| state |
string |
The status. Valid values: active and blocked. Default value: active. |
active |
| avatarUrl |
string |
The URL of the avatar. |
https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100 |
|
string |
The email address of the author. |
username@example.com |
|
| committer |
object |
The committer information. |
|
| id |
integer |
The Codeup user ID. |
43910 |
| name |
string |
The user name. |
Yunxiao Committer |
| username |
string |
The user nickname. |
Codeup-commiter |
| state |
string |
The status. Valid values: active and blocked. Default value: active. |
active |
| avatarUrl |
string |
The URL of the avatar. |
https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100 |
|
string |
The email address of the user. |
username@example.com |
|
| commentsCount |
integer |
The number of comments. |
1 |
| diffs |
array<object> |
The diff content. |
|
|
object |
The diff details. |
||
| diff |
string |
The diff details. |
--- /dev/null\n+++ b/mr_error.txt\n@@ -0,0 +1,3 @@\n+first\n+\n+Commit 2\n\\ No newline at end of file\n |
| newPath |
string |
The new file path. |
new_test.txt |
| oldPath |
string |
The old file path. |
test.txt |
| aMode |
string |
The file mode identifier of the old path, which includes information such as file type and permissions. For example, 100644 indicates a regular file, and 100755 indicates an executable file. |
100644 |
| bMode |
string |
The file mode identifier of the new path, which includes information such as file type and permissions. For example, 100644 indicates a regular file, and 100755 indicates an executable file. |
100644 |
| newFile |
boolean |
Indicates whether the file is newly added. |
false |
| renamedFile |
boolean |
Indicates whether the file is renamed. |
false |
| deletedFile |
boolean |
Indicates whether the file is deleted. |
false |
| isBinary |
boolean |
Indicates whether the file is a binary file. |
false |
| oldId |
string |
The Git object ID of the old file. |
6c268061a546378276559c713d0ad377d4dsjfh |
| newId |
string |
The Git object ID of the new file. |
cb75846da2df3d3d7f290c3569236fcf3dd17224 |
| isNewLfs |
boolean |
Indicates whether the new file is a Large File Storage (LFS) file. |
false |
| isOldLfs |
boolean |
Indicates whether the old file is a Large File Storage (LFS) file. |
false |
Examples
Success response
JSON format
{
"requestId": "ASSDS-ASSASX-XSAXSA-XSAXSAXS",
"errorCode": "SYSTEM_UNKNOWN_ERROR",
"errorMessage": "\"\"",
"success": true,
"result": {
"messages": [
"\"\""
],
"commits": [
{
"id": "b8f6f28520b1936aafe2e638373e19ccafa42b02",
"shortId": "b8f6f285",
"title": "Commit title",
"message": "\"\"",
"authorName": "Yunxiao Codeup",
"authorEmail": "username@example.com",
"authoredDate": "2023-01-03T15:41:26+08:00",
"createdAt": "2023-01-03T15:41:26+08:00",
"committerName": "Yunxiao CodeupCommitter",
"committerEmail": "username@example.com",
"committedDate": "2023-01-03T15:41:26+08:00",
"parentIds": [
"c9fb781f3d66ef6ee60bdd5c414f5106454b1426"
],
"author": {
"id": 21396,
"name": "Yunxiao",
"username": "Codeup",
"state": "active",
"avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
"email": "username@example.com"
},
"committer": {
"id": 43910,
"name": "Yunxiao Committer",
"username": "Codeup-commiter",
"state": "active",
"avatarUrl": "https://tcs-devops.aliyuncs.com/thumbnail/112afcb7a6a35c3f67f1bea827c4/w/100/h/100",
"email": "username@example.com"
},
"commentsCount": 1
}
],
"diffs": [
{
"diff": "--- /dev/null\\n+++ b/mr_error.txt\\n@@ -0,0 +1,3 @@\\n+first\\n+\\n+Commit 2\\n\\\\ No newline at end of file\\n",
"newPath": "new_test.txt",
"oldPath": "test.txt",
"aMode": "100644",
"bMode": "100644",
"newFile": false,
"renamedFile": false,
"deletedFile": false,
"isBinary": false,
"oldId": "6c268061a546378276559c713d0ad377d4dsjfh",
"newId": "cb75846da2df3d3d7f290c3569236fcf3dd17224",
"isNewLfs": false,
"isOldLfs": false
}
]
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.