Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

gerrit

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).

  1. How to make A listed on "Merged" web page ?
  2. How to make B disappear, so A has no more dependency on B ?
like image 212
gemfield Avatar asked Jan 05 '12 03:01

gemfield


People also ask

How do you merge changes in Gerrit?

To do that, you click the “Submit” button in the Gerrit Web UI just as you would click the “Merge Pull Request” button in GitHub. Both, Gerrit and GitHub, allow different merge strategies, that can be enabled by project administrators.

How do I update my Gerrit review?

Step 1 – Do the required modification in the code based on the review. Step 2 – Add files using git add commands. Step 3 – Command to update/amend the most recent commit. When amending a commit with git commit –amend, leave the Change-Id line unmodified in the commit message.


4 Answers

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.

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.

like image 143
Greg Hewgill Avatar answered Oct 17 '22 13:10

Greg Hewgill


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.

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.

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 .

like image 38
Maxim Suslov Avatar answered Oct 17 '22 14:10

Maxim Suslov


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.

like image 32
jastram Avatar answered Oct 17 '22 14:10

jastram


  1. Abandon your push from Gerrit.

On Terminal:

  1. git log
  2. git reset HEAD~n

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

  1. git add .
  2. git commit -m "Your message"
  3. git push

now merge your commit on Gerrit.

like image 33
Venu Gopal Tewari Avatar answered Oct 17 '22 13:10

Venu Gopal Tewari