美文网首页
CodeReview工具Phabricator

CodeReview工具Phabricator

作者: 已不再更新_转移到qiita | 来源:发表于2019-11-26 11:34 被阅读0次

    最初写于2016-05-25

    Phabricator 是 facebook 开源的一款CodeReview工具,集成了 Task、Wiki、代码审计等功能,也可以当做代码仓库。

    请先安装Phabricator,再执行下面的过程。

    安装 Arcanist

    Arcanist 是phabricator的命令行工具,具体说明请戳 Wiki

    mkdir work/
    cd work/
    git clone https://github.com/phacility/libphutil.git
    git clone https://github.com/phacility/arcanist.git
    export PATH="$PATH:/work/arcanist/bin/"
    

    权限验证

    在项目根目录添加 .arcconfig

    { "phabricator.uri": "http://pha.haotc.com/" }
    

    执行 arc install-certificate

    CONNECT Connecting to "http://pha.haobtc.com/api/"
    LOGIN TO PHABRICATOR
    Open this page in your browser and login to Phabricator if necessary:
    
    http://pha.haobtc.com/conduit/login/
    
    Then paste the API Token on that page below.
        Paste API Token from that page:
    
    

    按照提示打开 url, 把token粘贴到命令行.

    工作流程

    • 新建Task

    生成链接 http://pha.haotc.com/T234,T234就是task_id

    • 新建Branch
    git checkout -b  T234-guide
    git add . && git commit -m "guide"
    
    • 提交到 Phabricator

    执行 arc diff,填写 Summary、Test Plan(即task_id)、 Reviewers...

    T234-guide
    
    Summary:
    - add Guide
    - OCD
    
    Test Plan: T234
    Reviewers: Zeus, Hera, Poseidon, Apollon
    Subscribers: shooter
    
    ......
    
    

    生成链接 https://pha.haobtc.com/D578

    • Review 过程

    reviewer 通过 arc patch D578,把代码打包到本地,可以在代码预览页评论。

    Author可以多次修改、提交, 然后再 arc diff,循环迭代多次。

    比如 commit 一次,再提交到 Phabricator

    translation
    
    # Updating D578: T234-guide
    #
    # 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
    
    • Review通过, 提交到代码仓库

    代码通过后,Author 执行 arc land T234-guide

    TARGET  Landing onto "master", the default target under git.
    REMOTE  Using remote "origin", the default remote under git.
    FETCH  Fetching origin/master...
    These commits will be landed:
          - 03ebc4b translation
          - a5f4228 guide
    Landing revision 'D578: T234-guide'...
    BUILDS PASSED  Harbormaster builds for the active diff completed successfully.
    PUSHING  Pushing changes to "origin/master".
    Counting objects: 20, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (18/18), done.
    Writing objects: 100% (21/21), 4.14 KiB | 0 bytes/s, done.
    Total 21 (delta 20), reused 3 (delta 3)
    To https://github.com/haobtc/haobtc.git
       65038z..52925wd  5292zdd04f73b0691azq0ed1we098022wd783d19 -> master
    RESTORE  Switching back to "master".
    Cleaning up branch "T234-guide"...
    (Use `git checkout -b 234-guide 03ebc4b3b5645f6d52f257a9a8577371ebaee3bf` if you want it back.)
     DONE  Landed changes.
    

    这个Task的所有的 commit 压合成一个大的commit提交到代码仓库,commit 信息如下:

    T234-guide
    
    Summary: Guide
    Test Plan: T234
    Reviewers: Zeus, Hera, Poseidon, Apollon
    Reviewed By: Zeus
    Subscribers: shooter
    Maniphest Tasks: T234
    Differential Revision: http://pha.haobtc.com/D578
    

    注意

    • Task关闭,默认配置不能重新打开

    • Push到Phabricator的远程分支,不能强制更新,不能删除

    CodeReview 最重要的是大家共同参与,工具并不是最重要的。

    相关文章

      网友评论

          本文标题:CodeReview工具Phabricator

          本文链接:https://www.haomeiwen.com/subject/mqjewctx.html