如果还有第二个更新的评论,如何修改Gerrit的评论问题 [英] How to amend review issues in Gerrit when there is a second newer review also

查看:447
本文介绍了如果还有第二个更新的评论,如何修改Gerrit的评论问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仍在尝试学习如何使用Gerrit及其流程。我做的步骤


  1. 首先将 change1 推送至gerrit以复查HEAD:refs / for / develop

  2. 在同一分支上处理其他内容,并将 change2 复制到gerrit以查看HEAD:refs / for / develop

这两个提交都有gerrit Change-ID行

解决 change1 问题,所以我做了

  git checkout -b change1 <更改1的提交ID> 

完成我的更改并提交(将更改ID添加到提交消息中) b
$ b

  git add。 
git commit

现在当我做的时候

  git push origin HEAD:refs / for / develop 

我得到

 ! [远程拒绝] HEAD  - > refs / for / develop(squash首先提交)
错误:未能将一些文件推送到'ssh://adrian@192.168.7.100:29418 / CommunicationsLibrary'

如何解决堆叠评论中的问题并将其发布到gerrit,而无需再创建另一个评论?



  o master 
\
o提交A (在审查中,需要变更)
o提交B(审查中,不需要更改)

我通常在这里坐着做什么用于在第三次提交中对Commit A进行更改。我们的提交图如下所示:

  o master 
\
o提交A(审查中,需要更改)
o提交B(在审查中,不需要更改)
o提交C(对提交A的修改)

现在我执行 git rebase -i master 并重新排列Commit C以提交Commit A之后但提交B之前,然后将其压缩到Commit A 。提交图现在看起来像这样:

  o master 
\
o提交A'(提交A,包含来自Commit C)
o Commit B'的变化(与Commit B相同的变化,但是应用于Commit A而不是A)
$ b

最后, git review (或者用来向gerrit提交更改的任何命令)重新提交两个提交Gerrit。



这是因为这样的复杂情况,大多数人强烈建议在单独的分支中对每个独特的变化进行研究,然后压缩成在提交给Gerrit之前进行一次提交,而不是需要处理这些类型的情况,即同时对依赖性更改进行审查。


Still trying to learn how to use Gerrit and its process. Steps I did where

  1. Push first change1 to gerrit for review to HEAD:refs/for/develop
  2. Work on something else on same branch and push change2 to gerrit for review to HEAD:refs/for/develop

Both commits have gerrit Change-ID lines

So now I want to address issue for change1 so I did

git checkout -b change1 <change 1's commit id>

Made my changes and committed (adding the Change-ID to the commit message)

git add .
git commit

Now when I do

git push origin HEAD:refs/for/develop

I get

 ! [remote rejected] HEAD -> refs/for/develop (squash commits first)
error: failed to push some refs to 'ssh://adrian@192.168.7.100:29418/CommunicationsLibrary'

How do I fix issues in stacked reviews and post it to gerrit without having to create yet another review?

解决方案

When you have dependent reviews in Gerrit (that is, one change in review which is dependent on an earlier change which is simultaneously in review), and you need to make modifications to the earlier change, you effectively have to resubmit both changes (since the second change becomes dependent on a different "parent" commit)

So the situation is that you have two commits in a single branch off of the main development branch, like this:

o master
\
 o Commit A (in review, requires change)
 o Commit B (in review, no changes required)

What I generally do in this situation is to make the changes requested of Commit A in a third commit. Our commit graph now looks like this:

o master
\
 o Commit A (in review, requires change)
 o Commit B (in review, no changes required)
 o Commit C (modifications to Commit A)

Now I do git rebase -i master and reorder Commit C to come after Commit A but before Commit B, and then squash it into Commit A. The commit graph now looks like this:

o master
\ 
 o Commit A' (Commit A, incorporating the changes from Commit C)
 o Commit B' (the same changes made in Commit B, but applied to Commit A' instead of A)

Finally, git review (or whatever command you use to submit changes to gerrit) to re-submit both commits to Gerrit.

It's because of complications like this that most people strongly recommend working on each distinct change in a separate branch and then squashing down into a single commit before submitting to Gerrit, rather than needing to deal with these types of situations where you have dependent changes being reviewed at the same time.

这篇关于如果还有第二个更新的评论,如何修改Gerrit的评论问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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