将作者从Gerrit评论中排除 [英] Exclude author from gerrit review
问题描述
我想禁止更改的作者查看自己在 gerrit .我知道此建议的黑客行为,但事实并非如此不能真正解决问题.
I want to disallow the author of a change to review his/her own changes in gerrit. I'm aware of this suggested hack, but that doesn't really solve the issue.
现在我从Gerrit问题中学到了可以通过自定义序言代码,因此应该可以根据需要修改工作流程.但是,我之前从未修改过gerrit的工作流程,也不了解很多序言.
Now I learned from the gerrit issues that gerrit's hardcoded rules can be modified by custom prolog code, so it should potentially be possible to modify the workflow as I want. However, I have never modified gerrit's workflow before and I don't know much prolog.
使用此序言引擎,是否有人有一个实用的自定义gerrit自定义规则示例?
Does anyone have a small working example of custom rules for gerrit using this prolog engine?
由于他们不需要我的团队更改当前的工作流程,因此我很乐意接受其他方法来禁止作者进行自我审查.
I will happily accept other alternatives of how to forbid authors doing a self-review, given they do not require my team to change the current workflow.
推荐答案
I found a very easy answer in this google group: groups.google.com/disable-self-review
在父项目(默认为All-Projects项目)中,将其添加到refs/meta/config分支中的project.config文件中:
In a parent project (default is the All-Projects project) add this to the project.config file in refs/meta/config branch:
[access "refs/*"]
label-Code-Review = block -2..+2 group Change Owner
并在同一分支的groups文件中添加此行
and in the groups file in the same branch add this line
global:Change-Owner Change Owner
然后使用允许将权限插入子项目的project.config的语句:
Then take the statement that allows the right into the child project's project.config:
label-Code-Review = -2..+2 group Developers
确保在父项目中编写block语句,并在子项目中赋予权限.如果允许和阻止位于同一文件中,则允许将否定(请参阅
Make sure to do write the block statement in the parent project and give the rights in the child project. If allow and block are in the same file the allow will overrule (See this). This will block the owner of a change to give -2 or +2. It will leave the -1 and +1 options intact. You can add a similar statement for any other custom labels you might use.
这篇关于将作者从Gerrit评论中排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!