... | ... | @@ -149,185 +149,3 @@ |
|
|
您可以在评论中使用[快速操作](../project/quick_actions.html) , 评论也将会显示提交评论后即将执行的操作。
|
|
|
|
|
|
要向评论添加更多评论,请照常开始写评论,然后单击**添加到评论**按钮,这会将评论添加到评论中。 |
|
|
|
|
|
### 提交评审[](#submitting-a-review "Permalink")
|
|
|
|
|
|
If you have any comments that have not been submitted, you will see a bar at the bottom of the screen with two buttons:
|
|
|
|
|
|
* **舍弃** : **舍弃**所有尚未提交的评论.
|
|
|
* **完成审阅** :打开准备提交审阅的评论列表. 单击**提交评论**将发布所有评论. 此时将执行所有提交的快速操作.
|
|
|
|
|
|
另外,要通过待审核的评论完成整个审核,请执行以下操作:
|
|
|
|
|
|
* 单击**评论**上的" **完成审阅"**按钮.
|
|
|
* 在非评论注释的文本中使用`/submit_review` [快速操作](../project/quick_actions.html) .
|
|
|
|
|
|
[](img/review_preview.png)
|
|
|
|
|
|
提交审阅将向合并请求的每个应通知用户发送一封电子邮件,其中包含与之相关的所有注释.
|
|
|
|
|
|
因此,回复此电子邮件将在关联的合并请求上创建一个新注释.
|
|
|
|
|
|
## Filtering notes[](#filtering-notes "Permalink")
|
|
|
|
|
|
在 GitLab 11.5 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/26723) .
|
|
|
|
|
|
对于活动注释和用户注释等具有许多注释的问题,有时很难找到有用的信息. 有一种方法可以针对合并请求和问题从单个注释和线程中过滤注释.
|
|
|
|
|
|
从合并请求的" **讨论"**选项卡,或史诗/问题概述中,找到页面右侧的过滤器下拉菜单,您可以从中选择以下选项之一:
|
|
|
|
|
|
* **显示所有活动** :显示所有用户评论和系统注释(问题更新,对其他问题的提及,对描述的更改等).
|
|
|
* **仅显示评论** :仅在列表中显示用户评论.
|
|
|
* **仅显示历史记录** :仅显示活动记录.
|
|
|
|
|
|
[](img/index_notes_filters.png)
|
|
|
|
|
|
在给定问题或 MR 中选择过滤器之一后,GitLab 将保存您的首选项,这样当您从已登录的任何设备再次访问同一页面时,该首选项将保持不变.
|
|
|
|
|
|
## Suggest Changes[](#suggest-changes "Permalink")
|
|
|
|
|
|
在 GitLab 11.6 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/18008) .
|
|
|
|
|
|
作为审阅者,您可以在 Merge Request Diff 线程中使用简单的 Markdown 语法建议代码更改. 然后,合并请求作者(或具有适当[权限的](../permissions.html)其他用户)能够通过单击来应用这些建议,这将在应用了这些建议的用户创作的合并请求中生成提交.
|
|
|
|
|
|
1. 选择要更改的代码行,添加新注释,然后单击工具栏中的" **插入建议"**图标:
|
|
|
|
|
|
[](img/suggestion_button_v12_7.png)
|
|
|
|
|
|
2. 在注释中,将您的建议添加到预填充的代码块中:
|
|
|
|
|
|
[](img/make_suggestion_v12_7.png)
|
|
|
|
|
|
3. 单击**开始审查**或**加入审查** ,以您的评论添加到[审查](#merge-request-reviews) ,或者**现在添加注释** ,注释立即加入到线程.
|
|
|
|
|
|
注释中的"建议"可由合并请求作者直接从合并请求中应用:
|
|
|
|
|
|
[](img/apply_suggestion_v12_7.png)
|
|
|
|
|
|
一旦作者应用了一个建议,它将被标记为"已**应用"**标签,该线程将被自动解析,并且 GitLab 将创建一个新的提交,并将建议的更改直接推送到合并请求分支中的代码库中. 这样做需要[开发人员许可](../permissions.html) .
|
|
|
|
|
|
### Multi-line Suggestions[](#multi-line-suggestions "Permalink")
|
|
|
|
|
|
在 GitLab 11.10 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53310) .
|
|
|
|
|
|
审阅者还可以通过调整范围偏移,在合并请求差异线程中使用单个"建议"来建议对多行进行更改. 偏移量相对于 diff 线程的位置,并指定应用建议时要被建议替换的范围.
|
|
|
|
|
|
[](img/multi-line-suggestion-syntax.png)
|
|
|
|
|
|
在上面的示例中,建议涵盖了注释行上方的三行和注释行下方的四行. 应用时,它将用建议的更改从注释行*上方的* 3 行替换为注释行*下方*的 4 行.
|
|
|
|
|
|
[](img/multi-line-suggestion-preview.png)
|
|
|
|
|
|
**注意:**涵盖多行的建议仅限于已注释差异行*上方的* 100 行和*下方*的差异行*下方*的 100 行,每个建议最多可更改 200 行.
|
|
|
|
|
|
### Code block nested in Suggestions[](#code-block-nested-in-suggestions "Permalink")
|
|
|
|
|
|
如果您需要提出涉及[受限制的代码块](../markdown.html#code-spans-and-blocks)的建议,请将您的建议换成四个反引号,而不是通常的三个.
|
|
|
|
|
|
[](img/suggestion_code_block_editor_v12_8.png)
|
|
|
|
|
|
[](img/suggestion_code_block_output_v12_8.png)
|
|
|
|
|
|
### Configure the commit message for applied Suggestions[](#configure-the-commit-message-for-applied-suggestions "Permalink")
|
|
|
|
|
|
在 GitLab 12.7 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/13086) .
|
|
|
|
|
|
GitLab 在应用建议时使用默认的提交消息: `Apply %{suggestions_count} suggestion(s) to %{files_count} file(s)`
|
|
|
|
|
|
例如,假设用户将 3 条建议应用于 2 个不同的文件,则默认的提交消息将是: **将 3 条建议应用于 2 个文件**
|
|
|
|
|
|
可以自定义这些提交消息,以遵循您可能拥有的任何准则. 为此, **请**在项目的" **常规"**设置中展开" **合并请求"**选项卡,然后更改" **合并建议"**文本:
|
|
|
|
|
|
[](img/suggestions_custom_commit_messages_v13_1.jpg)
|
|
|
|
|
|
除了静态文本,您还可以使用以下变量:
|
|
|
|
|
|
| Variable | Description | 输出示例 |
|
|
|
| --- | --- | --- |
|
|
|
| `%{branch_name}` | 建议所应用到的分支的名称. | `my-feature-branch` |
|
|
|
| `%{files_count}` | 应用了建议的文件数. | **2** |
|
|
|
| `%{file_paths}` | 应用了建议文件的路径. 路径用逗号分隔. | `docs/index.md, docs/about.md` |
|
|
|
| `%{project_path}` | 项目路径. | `my-group/my-project` |
|
|
|
| `%{project_name}` | 项目的可读名称. | **我的项目** |
|
|
|
| `%{suggestions_count}` | 应用的建议数. | **3** |
|
|
|
| `%{username}` | 应用建议的用户的用户名. | `user_1` |
|
|
|
| `%{user_full_name}` | 应用建议的用户的全名. | **用户 1** |
|
|
|
|
|
|
例如,要自定义提交消息以输出**Addresses user_1 的评论** ,请将自定义文本设置为`Addresses %{username}'s review` .
|
|
|
|
|
|
**注意:** [#25381](https://gitlab.com/gitlab-org/gitlab/-/issues/25381)将为每个应用的建议(以及批量建议)引入自定义提交消息.
|
|
|
|
|
|
### Batch Suggestions[](#batch-suggestions "Permalink")
|
|
|
|
|
|
版本历史
|
|
|
|
|
|
* 在 GitLab 13.1 中作为[Alpha 功能](https://about.gitlab.com/handbook/product/#alpha) [引入](https://gitlab.com/gitlab-org/gitlab/-/issues/25486) .
|
|
|
* 它部署在功能标记后面,默认情况下处于禁用状态.
|
|
|
* 在 GitLab.com 上已禁用.
|
|
|
* 要在 GitLab 自管实例中使用它,请让 GitLab 管理员[启用它](#enable-or-disable-batch-suggestions) .
|
|
|
|
|
|
您可以一次应用多个建议,以减少为满足审阅者的请求而添加到分支的提交数量.
|
|
|
|
|
|
1. 要启动将在一次提交中应用的一批建议,请单击" **将建议添加到批处理"** :
|
|
|
|
|
|
[](img/add_first_suggestion_to_batch_v13_1.jpg)
|
|
|
|
|
|
2. 根据需要向批处理中添加尽可能多的其他建议:
|
|
|
|
|
|
[](img/add_another_suggestion_to_batch_v13_1.jpg)
|
|
|
|
|
|
3. 要删除建议,请单击" **从批处理中删除"** :
|
|
|
|
|
|
[](img/remove_suggestion_from_batch_v13_1.jpg)
|
|
|
|
|
|
4. 将所有建议添加到您的喜好中后,准备好后,请点击**应用建议** :
|
|
|
|
|
|
[](img/apply_batch_of_suggestions_v13_1.jpg)
|
|
|
|
|
|
#### Enable or disable Batch Suggestions[](#enable-or-disable-batch-suggestions "Permalink")
|
|
|
|
|
|
批处理建议部署在**默认情况下禁用**的功能标志的后面. [有权访问 GitLab Rails 控制台的 GitLab 管理员](../../administration/feature_flags.html)可以为您的实例启用它.
|
|
|
|
|
|
要启用它:
|
|
|
|
|
|
```
|
|
|
# Instance-wide
|
|
|
Feature.enable(:batch_suggestions)
|
|
|
```
|
|
|
|
|
|
禁用它:
|
|
|
|
|
|
```
|
|
|
# Instance-wide
|
|
|
Feature.disable(:batch_suggestions)
|
|
|
```
|
|
|
|
|
|
## Start a thread by replying to a standard comment[](#start-a-thread-by-replying-to-a-standard-comment "Permalink")
|
|
|
|
|
|
在 GitLab 11.9 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/30299)
|
|
|
|
|
|
要回复标准(非线程)评论,可以使用" **回复评论"**按钮.
|
|
|
|
|
|
[](img/reply_to_comment_button.png)
|
|
|
|
|
|
仅当您有权回复现有主题或从标准评论启动主题时,才会显示" **回复评论"**按钮.
|
|
|
|
|
|
单击" **回复评论"**按钮将使回复区域成为焦点,您可以键入回复.
|
|
|
|
|
|
[](img/reply_to_comment.gif)
|
|
|
|
|
|
提交回复后,回复非线程注释将把非线程注释转换为线程. 该转换被认为是对原始评论的修改,因此在其下方会出现一条有关上次编辑时间的注释.
|
|
|
|
|
|
此功能仅适用于"问题","合并请求"和"事件". 尚不支持提交,摘要和合并请求差异线程.
|
|
|
|
|
|
## Assign an issue to the commenting user[](#assign-an-issue-to-the-commenting-user "Permalink")
|
|
|
|
|
|
在 GitLab 13.1 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/191455) .
|
|
|
|
|
|
您可以将问题分配给发表评论的用户.
|
|
|
|
|
|
在评论中,单击" **更多操作"**菜单,然后单击" **分配给评论用户"** .
|
|
|
|
|
|
再次单击按钮以取消分配评论者.
|
|
|
|
|
|
[](img/quickly_assign_commenter_v13_1.png) |
|
|
\ No newline at end of file |