git Gerrit Change 有 Status:Submitted, Merge Pending, 如何解决?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8737326/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:38:46  来源:igfitidea点击:

Gerrit Change has Status:Submitted, Merge Pending, how to solve it?

gitgerrit

提问by gemfield

The Gerrit system is only used by us several people. Once there is a Change A, and its status is: "Submitted, Merge Pending". The change list in the "open" web page. Also I noticed this Change had a dependency on another change B (which status is abandoned).

Gerrit 系统只被我们几个人使用。一旦有一个变更A,其状态为:“已提交,合并待处理”。“打开”网页中的更改列表。我还注意到这个变化依赖于另一个变化 B(状态被放弃)。

  1. How to make A listed on "Merged" web page ?
  2. How to make B disappear, so A has no more dependency on B ?
  1. 如何使 A 列在“合并”网页上?
  2. 如何让 B 消失,让 A 不再依赖 B ?

回答by Greg Hewgill

If change A has a dependency on B, then A cannot be merged until B is merged. Since you have abandoned B, Gerrit will not automatically merge A.

如果变更 A 依赖于 B,则在合并 B 之前无法合并 A。既然你已经放弃了 B,Gerrit 就不会自动合并 A。

What you will need to do is modify A (perhaps using git rebase) so that it no longer depends on B, and resubmit the change to Gerrit.

您需要做的是修改 A(可能使用git rebase),使其不再依赖于 B,然后将更改重新提交给 Gerrit。

回答by Maxim Suslov

FYI. I had the same problem of "Submitted, Merge Pending" when user press submit twice on same page (she double clicked the submit button). It happened in Gerrit 2.11.

供参考。当用户在同一页面上按两次提交(她双击提交按钮)时,我遇到了同样的“提交,合并待处理”问题。它发生在 Gerrit 2.11 中。

Error in log looks like

日志中的错误看起来像

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:     Duplicate entry '5173-2-1' for key 'PRIMARY'
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

Before submitting there was only 1 commit (code changes). But after double pressing there are 2 commits. Second one is with new Commit Message and "Submitted, Merge Pending" status.

在提交之前只有 1 次提交(代码更改)。但是双击后有2次提交。第二个是新的提交消息和“已提交,合并待处理”状态。

When I removed all information about second commit:

当我删除有关第二次提交的所有信息时:

$ ssh -p 29418 admin@machine gerrit gsql
gerrit> delete from `patch_set_approvals` where change_id=5173 and patch_set_id=2;
gerrit> delete from `patch_set_ancestors` where change_id=5173 and patch_set_id=2;
gerrit> delete from `patch_sets` where change_id=5173 and patch_set_id=2;

it marked as integrated by user Gerrit Code Review .

它被用户 Gerrit Code Review 标记为已集成。

回答by jastram

What Greg states is correct, an automatic merge is not possible. It is possible to incorporate just A by using Gerrit's "cherry pick" option (essentially a manual merge). Unfortunately, this will not remove the "Merge Pending" status of Gerrit. I usually write a comment to this effect, if the Contributor cannot be troubled to rebase.

Greg 所说的是正确的,自动合并是不可能的。通过使用 Gerrit 的“樱桃选择”选项(基本上是手动合并),可以只合并 A。不幸的是,这不会删除 Gerrit 的“合并待处理”状态。如果贡献者不能麻烦rebase,我通常会为此写一篇评论。

回答by velly.zhou

Guy. If you commit has a tag, you may meet a bug. This bug had been fixed in Gerrit V2.7.

伙计。如果你提交有标签,你可能会遇到一个错误。此错误已在 Gerrit V2.7 中修复。

Bug reference: https://groups.google.com/forum/#!topic/repo-discuss/tLVMibfzroc

错误参考:https: //groups.google.com/forum/#!topic/repo-discuss/ tLVMibfzroc

回答by dyu

I had the same problem of "Submitted, Merge Pending" without any dependency or conflict. Quick fix is to go through all open items and see if there is any other commit in "Submitted, Merge Pending" status. If yes, just abandon them all.

我有同样的“提交,合并待处理”问题,没有任何依赖或冲突。快速修复是检查所有打开的项目,看看是否还有其他处于“已提交,合并待处理”状态的提交。如果是,就放弃它们。

Then git commit --amend -m "your original comments" and git push again, this time you can have your fix merged.

然后 git commit --amend -m "your original comments" 并再次 git push,这一次您可以合并您的修复程序。

回答by RzR

I faced this issue because I pushed a tag to branch name:

我遇到这个问题是因为我将标签推送到分支名称:

git tag x.y.z HEAD
git push -f origin x.y.z:master

So better push a branch instead,

所以最好推一个分支,

git tag x.y.z HEAD
git push -f origin HEAD:master

That way gerrit is able to merge again my pending patches.

这样 gerrit 就能够再次合并我的待处理补丁。

回答by Venu Gopal Tewari

  1. Abandon your push from Gerrit.
  1. 放弃 Gerrit 的推动。

On Terminal:

在终端上:

  1. git log
  2. git reset HEAD~n
  1. 混帐日志
  2. git 重置 HEAD~n

where n is the commit count from top in list of commits generated on terminal from step 2

其中 n 是第 2 步在终端上生成的提交列表中从顶部开始的提交计数

  1. git add .
  2. git commit -m "Your message"
  3. git push
  1. git 添加。
  2. git commit -m "你的消息"

now merge your commit on Gerrit.

现在合并您对 Gerrit 的提交。