host repository模式下强制code review通过herald来设置。
首页 -> more applications -> herald,点击右上角的create herald rule
,选择 commit hook: commit content, Rule type选择Global,规则具体内容如下:
When **all of **these conditions are met:
**Accepted Differential revision does not exist **
Take these actions every time this rule matches:
Block push with message: Review is required for all changes.
设置好以后,未发起code review就发起push会出现以下提示:
haocheng@Mac testpha$[b1] git push origin b1
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (10/10), 920 bytes | 0 bytes/s, done.
Total 10 (delta 2), reused 0 (delta 0)
remote: +---------------------------------------------------------------+
remote: | * * * PUSH REJECTED BY EVIL DRAGON BUREAUCRATS * * * |
remote: +---------------------------------------------------------------+
remote: \
remote: \ ^ /^
remote: \ / \ // \
remote: \ |\___/| / \// .\
remote: \ /V V \__ / // | \ \ *----*
remote: / / \/_/ // | \ \ \ |
remote: @___@` \/_ // | \ \ \/\ \
remote: 0/0/| \/_ // | \ \ \ \
remote: 0/0/0/0/| \/// | \ \ | |
remote: 0/0/0/0/0/_|_ / ( // | \ _\ | /
remote: 0/0/0/0/0/0/`/,_ _ _/ ) ; -. | _ _\.-~ / /
remote: ,-} _ *-.|.-~-. .~ ~
remote: \ \__/ `/\ / ~-. _ .-~ /
remote: \____(Oo) *. } { /
remote: ( (--) .----~-.\ \-` .~
remote: //__\\ \ DENIED! ///.----..< \ _ -~
remote: // \\ ///-._ _ _ _ _ _ _{^ - - - - ~
remote:
remote:
remote: This push was rejected by Herald push rule H16.
remote: Change: commit/
remote: Rule: herald_testpha
remote: Reason: Review is required for all changes.
remote: Transcript: http://phabricator-server/herald/transcript/1957/
remote:
To http://phabricator-server/diffusion/23/testpha.git
! [remote rejected] b1 -> b1 (pre-receive hook declined)
error: failed to push some refs to 'http://phabricator-server/diffusion/23/testpha.git'
网友评论