Phabricator支持兩種代碼審查工做流:「review」(提交前審查)和 「audit」(提交後審查)。
php
此文檔僅僅針對Linux用戶
對於Mac OS X用戶,請參照 Arcanist使用手冊: Mac OS X
對於Windows用戶,請參照 Arcanist使用手冊: Windowsgit
1.1 安裝以下軟件包github
sudo yum install php git
1.2 安裝Arcanistweb
$ mkdir somewhere/ $ cd somewhere/ somewhere/ $ git clone https://github.com/phacility/libphutil.git somewhere/ $ git clone https://github.com/phacility/arcanist.git
1.3 修改環境變量vim
$ export PATH="$PATH:/somewhere/arcanist/bin/" $ export EDITOR="/usr/bin/vim"
2、配置項目瀏覽器
注意:配置項目的詳情,請參照 Arcanist使用手冊: 配置新項目工具
在項目工做目錄下建立配置文件 .arcconfig測試
$ cd yourproject/ yourproject/ $ $EDITOR .arcconfig yourproject/ $ cat .arcconfig { "phabricator.uri" : "https://phab.域名.org/" }
3、安裝Arcanist證書ui
在安裝Arcanist證書以前,必須具備Phabricator帳號this
$ cd yourproject/ yourproject/ $ arc install-certificate
執行安裝證書命令,會看到以下內容
CONNECT Connecting ...
按照提示,在瀏覽器裏輸入 http://phab.域名.com/conduit/login/ ,會看到以下內容
獲取 API Token
拷貝API token到命令行,若是看到以下內容,代表證書安裝成功
SUCCESS
4、配置Lint
注意:Lint的詳情,請參照 Arcanist使用手冊: Lint
Lint是程序語言檢查工具的統稱,一般用來分析代碼並報出代碼中的錯誤及警告。
能夠經過以下命令列出當前支持的Lint。
$ arc linters
根據你項目的須要,在項目工做目錄下建立配置文件 .arclint
$ cd yourproject/ yourproject/ $ $EDITOR .arclint yourproject/ $ cat .arclint { "linters": { "merge-conflict": { "type": "merge-conflict" }, "php-syntax": { "type": "php", "include": "(\\.php$)" } } }
5、提交代碼到Review狀態
注意:arc diff的詳情,請參照 Arcanist使用手冊: arc diff
以下以將Arcanist配置文件提交到項目爲例,輸入以下命令提交代碼到Review狀態
$ arc diff
輸入命令,會有2次確認,填y便可。
其間,命令行會提示你輸入概述,測試計劃,修訂人(即你但願的代碼reviewer),以及訂閱者,內容以下
<<Replace this line with your Revision Title>> Summary: Test Plan: Reviewers: Subscribers: # NEW DIFFERENTIAL REVISION # Describe the changes in this new revision. 忽略#開頭的行: 開頭: 本次修改的詳細描述,必填,能夠換行(從第一行到Summary行)。 Summary: 本次修改的簡短描述,必填。 Test Plan: 留空,不填。 Reviewers: Reviewer的帳號,可填多個。能夠不填,以後打開Phabricator補上。
提交成功後,能夠在Phabricator的"Diff 檢閱"裏面看到你的提交處於"等待Reviewer審查"的狀態。
6、Reviewer審覈代碼
代碼Reviewer能夠線下或者經過線上來完成代碼審覈,審覈經過後在Phabricator的"Diff 檢閱"裏面找到相應的提交,並給出意見,經過或者拒絕。能夠設置操做和註解。
7、正式發佈代碼
代碼經過Review之後,做者能夠在Phabricator的"Diff 檢閱"裏面看到你的提交處於"Ready to Land"的狀態。
輸入以下命令正式發佈代碼
$ arc land
日誌會顯示提交信息,一次成功的提交已經完成了。
Phabricator操做說明
Waiting on Review
Comment #添加說明
Abandon Revison #廢棄版本
Plan Changes #改變計劃(—>Ready to Update)
Add Reviewers #添加審覈人
Add Subscribers #訂閱人Ready to Update
Comment #添加說明
Abandon Revison #廢棄版本
Request Review #從新請求Review,可添加審覈人(->Waiting on Review)
Add Reviewers #添加審覈人
Add Subscribers #訂閱人Ready to Review
Accept Revison #接受版本 (->Ready to Land)
Request Changes #請求改變 (->Waiting on Authors)
Resign as Reviewer #辭去審覈人
Commandeer Revison #角色互換(建立人變動爲審覈人)
Add Reviewers #添加審覈人
Add Subscribers #訂閱人Ready to Land
Comment #添加說明
Abandon Revison #廢棄版本
Request Review #從新請求Review,可添加審覈人(->Waiting on Review)
Plan Changes #改變計劃(—>Ready to Update)
Close Revison #關閉版本
Add Reviewers #添加審覈人
Add Subscribers #訂閱人Waiting on Authors
Comment #添加說明
Accept Revison #接受版本 (->Ready to Land)
Resign as Reviewer #更換審覈人
Commandeer Revison #角色互換(建立人變動爲審覈人)
Add Reviewers #添加審覈人
Add Subscribers #訂閱人
arc操做說明
arc diff // 提交默認的diff
arc diff xxx --preview // 提交針對某個分支的commit,並只生成diff文件,不在web端建立revision
arc which // 查看arc diff 會提交哪一個範圍的diff
arc land // 提交代碼,刪除該分支 or 使用 git push
arc list // 查看有哪些revision和其狀態
不足之處,歡迎指正!