设置arc 的默认编辑器

arc set-config editor "vim"

转自:http://udn.yyuap.com/thread-39791-1-1.html
Pharicator是FB的代码审查工具,现在我所在的团队也使用它来进行代码质量的控制。其提供了一个differential(code review)命令行工具Arcanist(arc)。本文仅从本人的日常使用中总结出Arcanist比较常用的用法做个简单介绍。

  环境说明
OS: OS X Mountail Lion
SCV: svn
IDE: Eclipse

  安装
将Arcanist的源码拷贝到本地

somewhere/ $ git clone git://github.com/facebook/libphutil.git
somewhere/ $ git clone git://github.com/facebook/arcanist.git
复制代码

将arc的路径加入到系统路径中

$ export PATH=$PATH:/somewhere/arcanist/bin/
复制代码

  或在系统的profile或是bash(如果用bash)的配置文件的末尾加上这一句。
命令行中输入arc看提示确认是否安装成功。

  arc配置
arc的全局配置

  配置arc的默认编辑器,我使用vim
$ arc set-config editor "vim"
复制代码

  配置默认的phabricator的uri,uri为团队的phabricator主页的url
$ arc set-config default http://phabricator.example.com
复制代码

在项目的根目录下建.arcconfig配置文件,文件中至少要填入以下内容

{
"project_id" : "your project name",
"conduit_uri" : "your phabricator url"
}
复制代码

  举个例子:
{
"project_id" : "HelloWorld",
"conduit_uri" : "http://phabricator.example.com"
}
复制代码

  该配置文件还可以配置静态代码检测引擎(lint)和单元测试引擎。
为项目安装证书,用于phabricator的认证。

yourproject/ $ arc install-certificate
复制代码

  接着按照命令行提示操作就OK了。

  弄完这一步,才能真正在项目中使用arc。

  在项目中使用arc
arc help [--full | [COMMAND]] 查看帮助文档,接参数--full查看所有命令的详细用法,接具体的命令[COMMAND]如arc help diff可以查看该命令的详细用法。
想phabricator提交review request(Differential).修改完代码后,使用arc diff 命令提交review request,该命令会产生一个包含如下内容的文件要求填写:

<>

Summary:

Test Plan:

Reviewers:

CC:

Maniphest Tasks:

NEW DIFFERENTIAL REVISION

Describe the changes in this new revision.

arc could not identify any existing revision in your working copy.

If you intended to update an existing revision, use:

$ arc diff --update

复制代码

  按照提示填写后,保存退出,arc就会自动提交request。Reviewers用逗号隔开,Maniphest Tasks填相关联的phabricator上的task_id,如T100。Test plan暂时没用过,官方文档:http://www.phabricator.com/docs/phabricator/article/Differential_User_Guide_Test_Plans.html

  提交完成后,会产生一个形如http://phabricator.example.com/D24的url,url中的D24是revision_id。
arc diff --update <revision_id>更新对应的review request。该命令产生一个如下的文件,按提示填写保存退出,arc会提交更新。

Updating D27: hahahah

Enter a brief description of the changes included in this update.

The first line is used as subject, next lines as comment.

If you intended to create a new revision, use:

$ arc diff --create

复制代码

arc commit --revision <revision_id>提交对应提交代码更改,这个命令把svn commit的工作也做掉了,直接提交到代码库。
arc todo [option]可以快速给自己在phabricator上创建task,[option]用于把task CC给其他人.
arc tasks [options] 查看Maniphest的tasks。
arc amend --show 查看当前项目的differentials,arc amend --revision <revision_id> --show 查看指定revision_id的differential。

  Reference:

  Arcanist官方文档: http://www.phabricator.com/docs/phabricator/article/Arcanist_User_Guide.html

原文地址:https://www.cnblogs.com/wangkongming/p/4991564.html