新增: 获取比较blame、token以及异常捕获处理

This commit is contained in:
2022-07-18 11:37:41 +08:00
parent e8deb83004
commit 6273349334
23 changed files with 912 additions and 419 deletions

View File

@@ -0,0 +1,40 @@
json.file_nums diff['NumFiles']
json.total_addition diff['TotalAddition']
json.total_deletion diff['TotalDeletion']
json.files diff['Files'].each do |file|
json.name file['Name']
json.oldname file['OldName']
json.addition file['Addition']
json.deletion file['Deletion']
json.type file['Type']
json.is_created file['IsCreated']
json.is_deleted file['IsDeleted']
json.is_bin file['IsBin']
json.is_lfs_file file['IsLFSFile']
json.is_renamed file['IsRenamed']
json.is_ambiguous file['IsAmbiguous']
json.is_submodule file['IsSubmodule']
json.sections file['Sections'] do |section|
json.file_name section['FileName']
json.name section['Name']
json.lines section['Lines'] do |line|
json.left_index line['LeftIdx']
json.right_index line['RightIdx']
json.match line['Match']
json.type line['Type']
json.content line['Content']
unless line['SectionInfo'].blank?
json.section_path line['SectionInfo']['Path']
json.section_last_left_index line['SectionInfo']['LastLeftIdx']
json.section_last_right_index line['SectionInfo']['LastRightIdx']
json.section_left_index line['SectionInfo']['LeftIdx']
json.section_right_index line['SectionInfo']['RightIdx']
json.section_left_hunk_size line['SectionInfo']['LeftHunkSize']
json.section_right_hunk_size line['SectionInfo']['RightHunkSize']
end
end
end
json.is_incomplete file['IsIncomplete']
json.is_incomplete_line_too_long file['IsIncompleteLineTooLong']
json.is_protected file['IsProtected']
end

View File

@@ -1,40 +1 @@
json.file_nums @result_object['NumFiles']
json.total_addition @result_object['TotalAddition']
json.total_deletion @result_object['TotalAddition']
json.files @result_object['Files'].each do |file|
json.name file['Name']
json.oldname file['OldName']
json.addition file['Addition']
json.deletion file['Deletion']
json.type file['Type']
json.is_created file['IsCreated']
json.is_deleted file['IsDeleted']
json.is_bin file['IsBin']
json.is_lfs_file file['IsLFSFile']
json.is_renamed file['IsRenamed']
json.is_ambiguous file['IsAmbiguous']
json.is_submodule file['IsSubmodule']
json.sections file['Sections'] do |section|
json.file_name section['FileName']
json.name section['Name']
json.lines section['Lines'] do |line|
json.left_index line['LeftIdx']
json.right_index line['RightIdx']
json.match line['Match']
json.type line['Type']
json.content line['Content']
unless line['SectionInfo'].blank?
json.section_path line['SectionInfo']['Path']
json.section_last_left_index line['SectionInfo']['LastLeftIdx']
json.section_last_right_index line['SectionInfo']['LastRightIdx']
json.section_left_index line['SectionInfo']['LeftIdx']
json.section_right_index line['SectionInfo']['RightIdx']
json.section_left_hunk_size line['SectionInfo']['LeftHunkSize']
json.section_right_hunk_size line['SectionInfo']['RightHunkSize']
end
end
end
json.is_incomplete file['IsIncomplete']
json.is_incomplete_line_too_long file['IsIncompleteLineTooLong']
json.is_protected file['IsProtected']
end
json.partial! "api/v1/projects/simple_gitea_diff_detail", diff: @result_object

View File

@@ -0,0 +1,18 @@
json.commits_count @result_object['CommitsCount']
json.last_commit_sha @result_object['LatestSha']
json.commits @result_object['Commits'] do |commit|
json.author do
json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(commit['Author']), name: commit['Author']['Name'] }
end
json.committer do
json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(commit['Committer']), name: commit['Committer']['Name'] }
end
json.branch commit['Branch']
json.commit_message commit['CommitMessage']
json.sha commit['Sha']
json.parent_shas commit['Sha']['ParentShas']
end
json.diff do
json.partial! "api/v1/projects/simple_gitea_diff_detail", diff: @result_object['Diff']
end