【ubuntu 18.04】phabricator配置远程仓库并实现code_review

1. 使用管理员创建仓库

2. 编辑仓库权限

 

 

 3. 编辑URI

 

 

 4. 配置Storage(自动生成)

 

 

 其他暂时可以不配

5. 相关配置

# 1. 配置arc到环境变量
cd arcanist/bin vim .bashrc
# 添加你自己的路径,export PATH=$PATH:/home/master/phabricator/arcanist/bin
# 然后:wq, source 生效
source .bashrc arc

# 2. 启动phd进程池,同步远程代码库要用 cd phabricator
/phabricator/ # 你自己的路径 ./bin/phd --help ./bin/phd start
# 3. 创建phabricator仓库目录
sudo mkdir /var/repo
sudo chmod -R 777 /var/repo

# 4. 同步仓库需要设置base-uri, 如下设置会导致样式丢失 #.
/bin/config set phabricator.base-uri 'http://192.168.10.99/'
vim conf
/local/local.json
# 修改"phabricator.base-uri": "http:\/\/192.168.10.99:8888\/",

# 5. 同步代码 .
/bin/repository update R1 --trace

 

6. 配置arc

# 1. 下载代码
git clone git@192.168.10.99:root/spring-boot-demo.git
# 配置提交用户,必须是phabricator的用户
git config user.name phabricator 
git config user.email phabricator@admin.ai

# 2. 配置用户token
arc
install-certificate
# 3. 设置diff默认编辑器,因为保存就可以提交, 原生的太难用 arc set-config editor "vim"

# 4. 仓库中添加如下两个文件,基础配置,代码格式化 vim .arclint vim .arcconfig
# 5. 提交cr arc
diff --browse 或 arc diff --trace
# 6. 审核之后提交代码
git pull origin master arc land

7. 相关文件内容

vim .arcconfig,只是个例子, 具体你自己配置
{
  "phabricator.uri": "http://192.168.10.99:8888/",
  "arc.lint.cache": true,
  "unit.target": "",
  "unit.custom_targets_dir": "/spring-boot-demo",
  "unit.custom_targets": [
    "check_release_path"
  ]
}
vim .arclint 只是个例子, 具体你自己配置
{
  "linters": {
    "pep8": {
      "type": "pep8",
      "include": [
        "(\\.py$)"
      ],
      "exclude": "(^third_party/)"
    }
  }
}
vim conf/local/local.json, 只是个例子, 具体你自己配置
{
  "phabricator.base-uri": "http:\/\/192.168.10.99:8888\/",
  "mysql.pass": "123456",
  "mysql.user": "root",
  "mysql.host": "localhost",
  "mysql.port": "3306",
  "differential.require-test-plan-field": false,
  "cluster.mailers": [
    {
      "key": "my-mailer",
      "type": "smtp",
      "options": {
        "host": "smtp.exmail.qq.com",
        "port": 465,
        "user": "auto@domain.com",
        "password": "123456",
        "protocol": "ssl"
      }
    }
  ],
  "metamta.default-address": "auto@domain.com"
}

8. 项目管理界面相关操作

 界面也可以同步仓库代码

 

 9. 启动phd

master@master:~/phabricator/phabricator$ ./bin/phd start
Freeing active task leases...
Freed 0 task leases.
Launching daemons:
(Logs will appear in "/var/tmp/phd/log/daemons.log".)

(Pool: 1) PhabricatorRepositoryPullLocalDaemon
(Pool: 1) PhabricatorTriggerDaemon
(Pool: 1) PhabricatorFactDaemon
(Pool: 4) PhabricatorTaskmasterDaemon

Done.

10. arc diff 界面

modify: readme.md   # commit信息

Summary:  # 提交简介

Test Plan: # 测试计划

Reviewers:  # 审核人员, 注意,不能是提交人员, 不然会报错

Subscribers: # 订阅人员

# NEW DIFFERENTIAL REVISION
# Describe the changes in this new revision.
#
# Included commits in branch master:
#
#         df14a7b28c0a modify: readme.md
#
# arc could not identify any existing revision in your working copy.
# If you intended to update an existing revision, use:
#
#   $ arc diff --update <revision>

例子, 加这个参数, 结束时会打开浏览器

master@master:~/spring-boot-demo$ arc diff --browse
You have untracked files in this working copy.

  Working copy: /home/master/spring-boot-demo/

  Untracked changes in working copy:
  (To ignore these 1 change(s), add them to ".git/info/exclude".)
    builds/

    Ignore these 1 untracked file(s) and continue? [y/N] y

Launching editor "vim"...
Provide the details for a new revision, then save and exit.
Linting...
No paths are lintable.
Running unit tests...
No unit test engine is configured for this project.
 SKIP STAGING  No staging area is configured for this repository.
Updating commit message...
Created a new Differential revision:
        Revision URI: http://192.168.10.99:8888/D2

Included changes:
  M       README.md

11. 评审界面

 

 12. arc land提交代码

master@master:~/spring-boot-demo$ arc land
 STRATEGY  Merging with "squash" strategy, the default strategy.
 SOURCE  Landing the current branch, "master".
 ONTO REMOTE  Remote "origin" was selected by following tracking branches upstream to the closest remote.
 ONTO TARGET  Landing onto target "master", selected by following tracking branches upstream to the closest remote branch.
 INTO REMOTE  Will merge into remote "origin" by default, because this is the remote the change is landing onto.
 INTO TARGET  Will merge into target "master" by default, because this is the "onto" target.
 FETCH  Fetching "master" from remote "origin"...

  $   git fetch --no-tags --quiet -- origin master


 INTO COMMIT  Preparing merge into "master" from remote "origin", at commit "0b9bfc9f1990".
 LANDING  These changes will land:

  *   D2 modify: readme.md
          a572175a25ee  modify: readme.md

 >>>  Land these changes? [y/N/?] y

 <!> UNCOMMITTED CHANGES 
You have uncommitted changes in this working copy.

    Working Copy: /home/master/spring-boot-demo//

Untracked changes in working copy:

    builds/

  ?   To configure Git to ignore certain files in this working copy,
      add the file paths to ".git/info/exclude".

 >>>  Stash these changes and continue? [y/N/?] n
 SAVE STASH  Saved uncommitted changes from working copy.
 MERGING  a572175a25ee modify: readme.md
 MERGE  Attempting to rebase changes.
 DONE  Merge succeeded.
 PUSHING  Pushing changes to "origin".

  $   git push -- origin 6fd646a1caa3:refs/heads/master

Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 383 bytes | 383.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To 192.168.10.99:root/spring-boot-demo.git
   0b9bfc9..6fd646a  6fd646a1caa3 -> master

 至此基本完成


 
posted @ 2021-12-21 20:59  代码诠释的世界  阅读(613)  评论(0编辑  收藏  举报