mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
新增: 获取单文件blame信息
This commit is contained in:
@@ -1614,6 +1614,203 @@ await octokit.request('GET /api/v1/yystopf/csfjkkj/commits/80dd40214a58622312393
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取单个文件的blame信息
|
||||
根据分支、标签、commitID获取某个文件的blame信息
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
-d "sha=master" \
|
||||
-d "filepath=hd.txt" \
|
||||
http://localhost:3000/api/v1/yystopf/csfjkkj/blame.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/v1/yystopf/csfjkkj/blame.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/v1/:owner/:repo/blame.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| | string |用户登录名 |
|
||||
|repo |是| | string |项目标识identifier |
|
||||
|sha |是| | string |分支、标签或提交记录id |
|
||||
|filepath|是| | string |文件路径|
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|file_size|int|文件大小|
|
||||
|file_name|string|文件名称|
|
||||
|num_lines|int|文件总行数|
|
||||
|blame_parts.commit|object|提交|
|
||||
|blame_parts.current_number|int|当前行数|
|
||||
|blame_parts.effect_line|int|影响的行数|
|
||||
|blame_parts.lines|array|行内容|
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"file_size": 32,
|
||||
"file_name": "hd.txt",
|
||||
"num_lines": 12,
|
||||
"blame_parts": [
|
||||
{
|
||||
"commit": {
|
||||
"sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
|
||||
"author": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"type": null,
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"committer": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"type": null,
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"commit_message": "fix\n",
|
||||
"authored_time": "2022-07-04 18:41:25",
|
||||
"committed_time": "2022-07-04 18:41:25",
|
||||
"created_time": "2022-07-04 18:41:25"
|
||||
},
|
||||
"current_number": 1,
|
||||
"effect_line": 5,
|
||||
"lines": [
|
||||
"dkfj",
|
||||
"s",
|
||||
"324",
|
||||
"234",
|
||||
"2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"commit": {
|
||||
"sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
|
||||
"author": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"type": null,
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"committer": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"type": null,
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"commit_message": "fix\n",
|
||||
"authored_time": "2022-07-05 11:00:45",
|
||||
"committed_time": "2022-07-05 11:00:45",
|
||||
"created_time": "2022-07-05 11:00:45"
|
||||
},
|
||||
"current_number": 6,
|
||||
"effect_line": 1,
|
||||
"lines": [
|
||||
"dd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"commit": {
|
||||
"sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
|
||||
"author": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"type": null,
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"committer": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"type": null,
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"commit_message": "fix\n",
|
||||
"authored_time": "2022-07-04 18:41:25",
|
||||
"committed_time": "2022-07-04 18:41:25",
|
||||
"created_time": "2022-07-04 18:41:25"
|
||||
},
|
||||
"current_number": 7,
|
||||
"effect_line": 3,
|
||||
"lines": [
|
||||
"23",
|
||||
"4",
|
||||
"23"
|
||||
]
|
||||
},
|
||||
{
|
||||
"commit": {
|
||||
"sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
|
||||
"author": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"type": null,
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"committer": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"type": null,
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"commit_message": "fix\n",
|
||||
"authored_time": "2022-07-05 11:00:45",
|
||||
"committed_time": "2022-07-05 11:00:45",
|
||||
"created_time": "2022-07-05 11:00:45"
|
||||
},
|
||||
"current_number": 10,
|
||||
"effect_line": 1,
|
||||
"lines": [
|
||||
"s1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"commit": {
|
||||
"sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
|
||||
"author": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"type": null,
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"committer": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"type": null,
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"commit_message": "fix\n",
|
||||
"authored_time": "2022-07-04 18:41:25",
|
||||
"committed_time": "2022-07-04 18:41:25",
|
||||
"created_time": "2022-07-04 18:41:25"
|
||||
},
|
||||
"current_number": 11,
|
||||
"effect_line": 1,
|
||||
"lines": [
|
||||
""
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
## 获取比较提交blame
|
||||
根据分支名、标签、commit ID来获取代码对比blame
|
||||
|
||||
|
||||
Reference in New Issue
Block a user