简体   繁体   English

Gerrit挂钩重定向

[英]Gerrit hooks redirection

Are you using any hooks for gerrit? 您是否在使用Gerrit钩子? I need one to scan the patchset. 我需要一个扫描补丁集。

I tried to create update hooks under GIT_DIR/hooks/ , but gerrit will bypass that hook when merge, while it works when pushing to git directly. 我试图在GIT_DIR/hooks/下创建更新挂钩,但是合并时gerrit会绕过该挂钩,而当直接推送到git时它会起作用。 Then I tried to create gerrit_site/hooks/patchset_created with +x permission. 然后,我尝试创建具有+ x权限的gerrit_site/hooks/patchset_created I can see the error_log like ' echo $GIT_DIR ', but the message cannot redirect to user interface like ssh terminal. 我可以看到error_log,例如“ echo $GIT_DIR ”,但是该消息无法重定向到ssh terminal这样的用户界面。 Also exit 0 and 1 doesn't block the pushing. 同样,退出0和1不会阻止推送。

Is it possible for the gerrit hook acts as git one which can redirect message to user and block some patchset? Gerrit钩子是否有可能像git one一样将消息重定向到用户并阻止某些补丁集?

Is it possible for the gerrit hook acts as git one which can redirect message to user and block some patchset? Gerrit钩子是否有可能像git one一样将消息重定向到用户并阻止某些补丁集?

No. Gerrit hooks cannot block action and cannot redirect output back to the user. 不能。Gerrit钩子不能阻止操作,也不能将输出重定向回用户。 They run post-action, so the action is already done by the time the hook is called. 它们运行后操作,因此在调用该挂钩时该操作已经完成。 See the official documentation at http://gerrit-documentation.googlecode.com/svn/Documentation/2.4.2/config-hooks.html 请参阅官方文档, 网址http://gerrit-documentation.googlecode.com/svn/Documentation/2.4.2/config-hooks.html

Adding pre-commit hooks is being worked on currently and will be available in future versions of Gerrit, likely as a plugin. 添加预提交的钩子目前正在研究中,并将在Gerrit的将来版本中提供,可能会作为插件使用。

The best current option is to create a Gerrit hook which scans the patchset like you describe and then comments on the change in Gerrit using the ssh interface. 当前最好的选择是创建一个Gerrit钩子,该钩子按照您的描述扫描补丁集,然后使用ssh界面对Gerrit中的更改进行注释。 At $dayjob, we use such a hook to give a -2 review score automatically to patches with commit messages which don't meet our standards. 在$ dayjob,我们使用这样的钩子对具有不符合我们标准的提交消息的补丁自动给予-2评分。

它似乎没有记录,我自己还没有测试过,但是ref-update(没有ref-updated的d)钩子似乎可以满足您的要求: https : //gerrit-review.googlesource.com/#/ c / 31350 /

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM