arcanist是phabricator创建的代码审核辅助工具,其作用参见图:

1.安装

安装Arcanist很简单,从github上拉两个代码库到本地的同一个文件夹,再配置环境变量即可


git clone https://github.com/phacility/arcanist.git 
git clone https://github.com/phacility/libphutil.git
vim /etc/profile  #添加以下内容  #/Users/qinshixu/test/ 为arcanist所在的目录
export PATH="$PATH:/Users/qinshixu/test/arcanist/bin"
source /etc/profile
arc help     # 查看命令帮助信息  

2.在项目中添加引用


cd your_project  #进入项目目录
vim .arcconfig   #增加以下内容
{
        "phabricator.uri": "https://***/", #phabricator 访问地址
        "editor": "vim"
}
为项目安装证书,用于phabricator的认证
arc install-certificate   

API Token 验证成功

3.提交Differential


git add    
git commit -m "***"
arc diff    # 提交review request,由vim打开,填写以下信息,wq保存退出
    Test Plan:      #必填,详细说明你的测试计划 
    Reviewers:      #必填,审查人的账户,多个使用”,”隔开;
    Subscribers:    #非必填订阅人,多个使用”,”隔开

#提交成功后,审查人就能在Differential收到通知
#审查人将状态修改为Accept Revision表示通过,通过后,使用
arc land   ##进行代码push,默认是master分支

4.命令指南


Arcanist可以做如下的事:
•   arc help :获得arc中包装的可用指令/工具
•   arc diff :发送代码的差异Differential功能,以便回顾(有关该指令的更多信息, 可见 Arcanist User Guide: arc diff)
•   arc list :显示未提交修改的代码信息 
•   arc cover :可以找到某个代码修改的提交人 
•   arc patch:  适应某已修改,并在这个修改上进行工作
•   arc export:通过Differential功能下载/导出一个补丁文件 
•   arc amend:审核Git更新提交后的信息
•   arc commit:提交SVN库的修改
•   arc land:向服务器端推送Git 和 Mercurial库的修改
•   arc branch:可以看到更多有关Git分支的信息

  1. 分支提交

    1.git checkout 分支名
    2.git add xx
    3.git commit -m ""
    4.arc diff 分支名
    5.arc land --onto 分支名 #push到分支