Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
862c5635
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
862c5635
编写于
12月 18, 2018
作者:
J
Jacques Erasmus
提交者:
Achilleas Pipinellis
12月 18, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Suggest diff line change documentation
上级
aa343d54
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
92 addition
and
0 deletion
+92
-0
doc/api/suggestions.md
doc/api/suggestions.md
+36
-0
doc/user/discussions/img/insert_suggestion.png
doc/user/discussions/img/insert_suggestion.png
+0
-0
doc/user/discussions/img/make_suggestion.png
doc/user/discussions/img/make_suggestion.png
+0
-0
doc/user/discussions/img/suggestion.png
doc/user/discussions/img/suggestion.png
+0
-0
doc/user/discussions/index.md
doc/user/discussions/index.md
+45
-0
doc/user/permissions.md
doc/user/permissions.md
+1
-0
doc/user/project/merge_requests/index.md
doc/user/project/merge_requests/index.md
+10
-0
未找到文件。
doc/api/suggestions.md
0 → 100644
浏览文件 @
862c5635
# Suggest Changes API
Every API call to suggestions must be authenticated.
## Applying suggestions
Applies a suggested patch in a merge request. Users must be
at least
[
Developer
](
../user/permissions.md
)
to perform such action.
```
PUT /suggestions/:id/apply
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
|
`id`
| integer/string | yes | The ID of a suggestion |
```
bash
curl
--request
PUT
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v4/suggestions/5/apply
```
Example response:
```
json
{
"id"
:
36
,
"from_original_line"
:
10
,
"to_original_line"
:
10
,
"from_line"
:
10
,
"to_line"
:
10
,
"appliable"
:
false
,
"applied"
:
true
,
"from_content"
:
"
\"
--talk-name=org.freedesktop.
\"
,
\n
"
,
"to_content"
:
"
\"
--talk-name=org.free.
\"
,
\n
\"
--talk-name=org.desktop.
\"
,
\n
"
}
```
doc/user/discussions/img/insert_suggestion.png
0 → 100644
浏览文件 @
862c5635
19.4 KB
doc/user/discussions/img/make_suggestion.png
0 → 100644
浏览文件 @
862c5635
27.8 KB
doc/user/discussions/img/suggestion.png
0 → 100644
浏览文件 @
862c5635
38.8 KB
doc/user/discussions/index.md
浏览文件 @
862c5635
...
...
@@ -293,6 +293,51 @@ Once you select one of the filters in a given issue or MR, GitLab will save
your preference, so that it will persist when you visit the same page again
from any device you're logged into.
## Suggest Changes
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/18008) in GitLab 11.6.
As a reviewer, you're able to suggest code changes with a simple
markdown syntax in Merge Request Diff discussions. Then, the
Merge Request author (or other users with appropriate
[
permission
](
../permissions.md
)
) is able to apply these
suggestions with a click, which will generate a commit in
the Merge Request authored by the user that applied them.
1.
Choose a line of code to be changed, add a new comment, then click
on the
**Insert suggestion**
icon in the toolbar:
![Add a new comment](img/insert_suggestion.png)
> **Note:**
The suggestion will only affect the commented line. Multi-line
suggestions are currently not supported. Will be introduced by
[#53310](https://gitlab.com/gitlab-org/gitlab-ce/issues/53310).
1.
In the comment, add your suggestion to the pre-populated code block:
![Add a suggestion into a code block tagged properly](img/make_suggestion.png)
1.
Click
**Comment**
.
The suggestions in the comment can be applied by the merge request author
directly from the merge request:
![Apply suggestions](img/suggestion.png)
> **Note:**
Discussions are _not_ automatically resolved. Will be introduced by
[#54405](https://gitlab.com/gitlab-org/gitlab-ce/issues/54405).
Once the author applies a suggestion, it will be marked with the
**Applied**
label,
and GitLab will create a new commit with the message
`Apply suggestion to <file-name>`
and push the suggested change directly into the codebase in the merge request's branch.
[
Developer permission
](
../permissions.md
)
is required to do so.
> **Note:**
Custom commit messages will be introduced by
[
#54404
](
https://gitlab.com/gitlab-org/gitlab-ce/issues/54404
)
.
[
ce-5022
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5022
[
ce-7125
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7125
[
ce-7527
]:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7527
...
...
doc/user/permissions.md
浏览文件 @
862c5635
...
...
@@ -79,6 +79,7 @@ The following table depicts the various user permission levels in a project.
| View approved/blacklisted licenses
**[ULTIMATE]**
| | | ✓ | ✓ | ✓ |
| Use security dashboard
**[ULTIMATE]**
| | | ✓ | ✓ | ✓ |
| Dismiss vulnerability
**[ULTIMATE]**
| | | ✓ | ✓ | ✓ |
| Apply code change suggestions | | | ✓ | ✓ | ✓ |
| Use environment terminals | | | | ✓ | ✓ |
| Add new team members | | | | ✓ | ✓ |
| Push to protected branches | | | | ✓ | ✓ |
...
...
doc/user/project/merge_requests/index.md
浏览文件 @
862c5635
...
...
@@ -150,6 +150,16 @@ in a Merge Request. To do so, click the **...** button in the gutter of the Merg
![
Comment on any diff file line
](
img/comment-on-any-diff-line.png
)
## Suggest changes
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/18008) in GitLab 11.6.
As a reviewer, you can add suggestions to change the content in
merge request discussions, and users with appropriate
[
permission
](
../../permissions.md
)
can easily apply them to the codebase directly from the UI. Read
through the documentation on
[
Suggest changes
](
../../discussions/index.md#suggest-changes
)
to learn more.
## Resolve conflicts
When a merge request has conflicts, GitLab may provide the option to resolve
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录