phabricator實戰使用

phabricator實戰使用

根據我們上一節我們隊phabricator的認識和基本環境的搭建以後,我們在本講中更全面的瞭解到這個工具的使用。

note:在使用這個工具的時候,要求我們對vim有一個基本的使用和了解,因爲我們發送code review請求都是通過命令行來發送的。

Arcanist命令使用

  • 通過arc help 可以查看arc所支持的所有命令
  • 詳細的幫助文檔,arc help –full
  • arc diff 發送代碼差異到codereview系統
  • arc list 顯示未提交修改的代碼信息
  • arc cover 可以找到某個代碼修改的提交人
  • arc patch 適應某個修改,並在這個修改上進行工作
  • arc export 通過Differential功能下載/導出一個補丁文件
  • arc amend 審覈git更新提交後的信息
  • arc commit svn提交代碼庫的更改
  • arc land 向服務器推送git代碼庫的更改
  • arc branch 可以看到跟過的有關git分支

在項目中是怎樣使用arc的,我在這裏簡單做一個demo

1 查看分支的情況


➜  shane git:(developer) git branch 
 - developer
  master

2 在要開發得分支上新開一個分支


git branch zhangyuqing developer
git checkout zhangyuqing

3 進行修改代碼工作並提交審覈


vim zhangyuqing.txt
git add zhangyuqing.txt 
git commit -m 'add zhangyuqing.txt'
arc diff --create  develop或者arc diff develop 一般都會強制創建新的審覈請求
note: 此處要添加對比的branch名字,否則可能會不知道從何處開始對比
 

arc diff詳細信息展示如下:


fix some bugs

Summary:  fix some bugs
fix some bugs

add zhangyuqing.txt

Test Plan: fix some bugs  @shane

Reviewers: test

Reviewed By: test

Subscribers:

Differential Revision: http://10.100.16.251:8080/D2

保存後會顯示這樣一個ID號碼


Created a new Differential revision:
        Revision URI: http://10.100.16.251:8080/D2

Included changes:
  A       fix.txt
  A       zhangyuqing.txt

這個時候我們使用arc list可以查看到該審覈請求的問題信息,並且等待你的leader或者小組其他成員對代碼進行review


➜  shane git:(zhangyuqing) arc list
* Needs Review D2: fix some bugs

➜  shane git:(zhangyuqing) arc list
* Accepted D2: fix some bugs

當你的代碼被其他人同意之後,最後一步執行向代碼庫中提交代碼


➜  shane git:(zhangyuqing) arc land zhangyuqing --onto developer
Switched to branch developer. Updating branch...
The following commit(s) will be landed:

a4715df fix some bugs
12b2e32 add zhangyuqing.txt

Switched to branch zhangyuqing. Identifying and merging...
Landing revision 'D2: fix some bugs'...
Merging zhangyuqing into developer
Already up-to-date.
Pushing change...

Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 420 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To http://10.3.4.127:8888/yq.zhang08/shane.git
   6ade274..204c773  developer -> developer

Cleaning up feature branch...
(Use `git checkout -b 'zhangyuqing' 'a4715dfa9fabb6a986bb1f14dde8cd36fe958ba3'` if you want it back.)
Done.

此時再去查看,D2這個問題已經沒了,並且系統會自動關閉該審覈請求


➜  shane git:(developer) arc list
You have no open Differential revisions.

ps: 整個流程到此就結束了,在最後一步如果有衝突的話就會push失敗,那麼解決方案就跟我們之前解決衝突一樣的了,執行arc land它會自動刪除你創建的臨時分支,並且切回開發得分支中。整個過程中全程郵件發送。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章