設置arc 的默認編輯器

arc set-config editor "vim"html

轉自:http://udn.yyuap.com/thread-39791-1-1.html
Pharicator是FB的代碼審查工具,如今我所在的團隊也使用它來進行代碼質量的控制。其提供了一個differential(code review)命令行工具Arcanist(arc)。本文僅從本人的平常使用中總結出Arcanist比較經常使用的用法作個簡單介紹。git

  環境說明
OS: OS X Mountail Lion
SCV: svn
IDE: Eclipsegithub

  安裝
將Arcanist的源碼拷貝到本地vim

somewhere/ $ git clone git://github.com/facebook/libphutil.git
somewhere/ $ git clone git://github.com/facebook/arcanist.git
複製代碼bash

將arc的路徑加入到系統路徑中編輯器

$ export PATH=$PATH:/somewhere/arcanist/bin/
複製代碼ide

  或在系統的profile或是bash(若是用bash)的配置文件的末尾加上這一句。
命令行中輸入arc看提示確認是否安裝成功。svn

  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 更新對應的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 提交對應提交代碼更改,這個命令把svn commit的工做也作掉了,直接提交到代碼庫。
arc todo [option]能夠快速給本身在phabricator上建立task,[option]用於把task CC給其餘人.
arc tasks [options] 查看Maniphest的tasks。
arc amend --show 查看當前項目的differentials,arc amend --revision --show 查看指定revision_id的differential。

  Reference:

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

相關文章
相關標籤/搜索