有没有一种方法可以强制Gerrit将分支中的所有提交推送到代码审查中? [英] Is there a way to force Gerrit to have all commits in a branch be push to code review?

查看:430
本文介绍了有没有一种方法可以强制Gerrit将分支中的所有提交推送到代码审查中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gerrit将合并提交历史记录中较早的潜在未审查更改,并将它们存储在存储库的不同分支"中.这是一个示例:

Gerrit will merge potentially unreviewed changes that are earlier in the commit history and are in a different 'branch' of the repository. Here's an example:

  1. 结帐Gerrit分支devel
  2. 创建file1.txt,添加,提交,推送到refs/heads/temp_branch
  3. 创建file2.txt,添加,提交,推送到refs/for/devel以进行代码审查
  1. checkout gerrit branch devel
  2. create file1.txt, add, commit, push to refs/heads/temp_branch
  3. create file2.txt, add, commit, push to refs/for/devel to be code reviewed

当file2.txt被接受并合并时,然后file1.txt(因为它位于上游且不在单独的更改分支中,被标记为正在审核)也被合并.这可能很成问题,我唯一能提出的解决方案强制每个推送到每个分支的更改都要进行代码审查.这是不理想的,因为您可能希望某些分支具有一组批准者,或者不进行代码审查(是否需要进行某些代码交换?).

When file2.txt is accepted and merged then file1.txt, because it's upstream and not in a separate change branch flagged as being under review, also gets merged in. This is potentially very problematic and the only solution I can come up with is to force every change pushed to every branch be code reviewed. This is not ideal, as you may want to have some branches with one group of approvers, or with no code review (for some code swapping?).

这里的解决方案是强制将历史记录中的每个提交都放入代码审查中,就像未将file1.txt推送到同一存储库中的其他分支一样.

The solution here is to force every commit in the history be placed into code review, as would be the case had file1.txt not been pushed to a different branch in the same repository.

Gerrit中是否存在强制执行此规则的设置? 谁能想到一个允许自由推送到refs/heads/而不冒污染其他分支机构风险的工作流程吗?

Is there a setting in Gerrit that imposes this rule? Can anyone think of a workflow that allows for the freedom to push to refs/heads/ without risking polluting other branches?

非常感谢.

推荐答案

我怀疑您正在看到此行为,因为步骤3中的提交将步骤2中的提交作为其父级.除非已提交所有提交,否则您不能提交提交.我同意您的看法,这似乎是Gerrit中的错误-在提交第2步之前,它应该拒绝提交.

I suspect you are seeing this behavior because the commit in step 3 has step 2's commit as its parent. You can't submit a commit unless all of its parents have been submitted. I agree with you that this seems like a bug in Gerrit - it should refuse to submit until step 2 has been submitted.

尝试此变通方法-在第2步之后添加第2a步.

Try this work-around - add step 2a after step 2:

2a.再次检查devel分支

2a. checkout the devel branch again

如果提交要转到2个不同的分支,则将它们线性化是没有意义的.

If the commits are going to 2 different branches, it doesn't make sense for them to be linear.

另一个想法-您正在为该项目使用哪种合并策略?如果是樱桃采摘,我会尝试将其更改为需要时合并,或者如果不是樱桃采摘,我会尝试将其更改为樱桃采摘.我相信这里的行为在合并策略之间是不同的.

One other thought - what merge strategy are you using for this project? If it is cherry-pick, I'd try changing it to merge-if-needed, or if it isn't cherry-pick I'd try changing it to cherry-pick. I believe the behavior here is different between the merge strategies.

这篇关于有没有一种方法可以强制Gerrit将分支中的所有提交推送到代码审查中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆