forked from Gitlink/forgeplus
ADD sha column ro pull request's files compare api
This commit is contained in:
parent
6b505a34cb
commit
97973b95bf
|
@ -2403,7 +2403,7 @@ GET /api/:owner/:repo/pulls/:id/files.json
|
|||
*示例*
|
||||
```
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/Jason/repo/pulls/1/files.json | jq
|
||||
http://localhost:3000/api/Jason/test-txt/pulls/1/files.json | jq
|
||||
```
|
||||
*请求参数说明:*
|
||||
|
||||
|
@ -2422,6 +2422,7 @@ http://localhost:3000/api/Jason/repo/pulls/1/files.json | jq
|
|||
|total_addition |int|添加代码总行数|
|
||||
|total_deletion |int|删除代码总行数|
|
||||
|files |array||
|
||||
|-- sha |string|commit's sha value|
|
||||
|-- name |string|当前文件名|
|
||||
|-- old_name |string| 修改之前的文件名称,与name相同的话,说明文件名未更改|
|
||||
|-- addition |int|文件添加的行数|
|
||||
|
@ -2457,6 +2458,7 @@ http://localhost:3000/api/Jason/repo/pulls/1/files.json | jq
|
|||
"total_deletion": 0,
|
||||
"files": [
|
||||
{
|
||||
"sha": "xefenisnii",
|
||||
"name": "文件.txt",
|
||||
"old_name": "文件.txt",
|
||||
"index": 6,
|
||||
|
@ -2617,10 +2619,12 @@ http://localhost:3000/api/ysfns/test-txt/compare/master...Jason/test-txt:develop
|
|||
|-- time_from_now|string|commit’s 提交时间距当前时间的时间值|
|
||||
|-- message |string|commit说明信息|
|
||||
|-- sha |string|commit’s sha值|
|
||||
|diff |array||
|
||||
|diff |object||
|
||||
|-- files_count |int|文件更改的总数量|
|
||||
|-- total_addition |int|添加代码总行数|
|
||||
|-- total_deletion |int|删除代码总行数|
|
||||
|-- files |Array||
|
||||
|-- sha |string|commit's sha |
|
||||
|-- name |string|当前文件名|
|
||||
|-- old_name |string| 修改之前的文件名称,与name相同的话,说明文件名未更改|
|
||||
|-- addition |int|文件添加的行数|
|
||||
|
|
|
@ -8,6 +8,6 @@ json.diff do
|
|||
json.files_count @compare_result['Diff']['NumFiles']
|
||||
json.total_addition @compare_result['Diff']['TotalAddition']
|
||||
json.total_deletion @compare_result['Diff']['TotalDeletion']
|
||||
json.files @compare_result['Diff']['Files'], partial: 'pull_requests/diff_file', as: :file
|
||||
json.files @compare_result['Diff']['Files'], partial: 'pull_requests/diff_file', as: :file, locals: {sha: @compare_result['LatestSha']}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
json.sha sha
|
||||
json.name file['Name']
|
||||
json.old_name file['OldName']
|
||||
json.index file['Index']
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
json.files_count @files_result['NumFiles']
|
||||
json.total_addition @files_result['TotalAddition']
|
||||
json.total_deletion @files_result['TotalDeletion']
|
||||
json.files @files_result['Files'], partial: 'diff_file', as: :file
|
||||
json.files @files_result['Files'], partial: 'diff_file', as: :file, locals: {sha: @files_result['LatestSha']}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
json.files_count @commit_diff['NumFiles']
|
||||
json.total_addition @commit_diff['TotalAddition']
|
||||
json.total_deletion @commit_diff['TotalDeletion']
|
||||
json.files @commit_diff['Files'], partial: 'pull_requests/diff_file', as: :file
|
||||
json.files @commit_diff['Files'], partial: 'pull_requests/diff_file', as: :file, locals: {sha: ""}
|
||||
|
||||
json.partial! 'commit', commit: @commit, project: @project
|
||||
json.parents @commit['parents'] do |parent|
|
||||
|
|
Loading…
Reference in New Issue