认识 Gerrit


官网

https://gerrit.asterisk.org/Documentation/index.html#_quickstarts


gerrit 的结构

  • 传统项目
    在这里插入图片描述

  • gerrit项目
    在这里插入图片描述

      引入了一个新的概念 Pending Changes
      所有修改都先发送到Pending Changes, 供其他人查看和讨论
      当足够的Reviewer批准代码更改时, 才可以将更改提交代码库
    

gerrit 的生命周期

  1. Making the change

  2. Creating the review

    """ 提交更改到Pending Change区域 """
    git commit
    
    git push origin HEAD:refs/for/master
    # git push origin HEAD:refs/for/<branch_name>
    
  3. Reviewing the change

     界面操作
     	+2  -->  Looks good to me, approved
     	+1  -->  Looks good to me, but someone else must approve
     	0   -->  No score
     	-1  -->  I would prefer that you didn’t submit this
     	-2  -->  Do not submit
    
  4. Reworking the change

     reviewer 打负分说明需要更改
     Cover Message文本框内可以添加理由
     通知会通过邮件发给Developer
     修改问题后, 再提交审核
    
  5. Verifying the change

     验证可以由自动化工具完成, 也可以手动
     UI界面内提供了每个分支的下载
     Verified 评分+1则验证通过
    
  6. submitting the change

     界面操作
     	在"代码审查"界面打开更改, 并点击"提交"
     	此时更改合并到代码库的master分支中
    

commit-msg Hook

"""
顾名思义, 提交消息挂钩
可以将正在审核的相同更改的不同版本链接在一起
"""

# 本地Git库安装钩子后, 消息如下
Improve foo widget by attaching a bar.

We want a bar, because it improves the foo by providing more
wizbangery to the dowhatimeanery.

Signed-off-by: A. U. Thor <author@example.com>

# 插入新的"Change-ID", 消息如下
Improve foo widget by attaching a bar.

We want a bar, because it improves the foo by providing more
wizbangery to the dowhatimeanery.

Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b
Signed-off-by: A. U. Thor <author@example.com>

# 获取钩子文件, 使用scp wget curl
scp -p -P 29418 <your username>@<your Gerrit review server>:hooks/commit-msg <local path to your git>/.git/hooks/

# 确保钩子文件可执行
chmod u+s <local path to your git>/.git/hooks/commit-msg

添加用户

# 在服务器执行
htpasswd xx/gerrit/review_sites/etc/passwords username

# 根据提示输入密码

# 在web端根据这个用户名密码登录, 注册为gerrit用户

# 在gerrit, project中设置权限
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值