Automatic Submit (and Merge) review

816 views
Skip to first unread message

Jacek Ziora

unread,
Jun 15, 2016, 10:24:46 AM6/15/16
to Repo and Gerrit Discussion
Hi!

When I want to merge a change, it has to be closed (Code Review +2) and Submitted (with 'parents' of course).

Is it possible to automatically Submit (and merge actually) review when it is given CR+2? Of course only when all parents have also CR+2.

Best regards,
Jacek Ziora

Jacek Ziora

unread,
Jun 16, 2016, 7:58:31 AM6/16/16
to Repo and Gerrit Discussion
Ok, so if it's not possible to do it automatically, I would like to do this one a day by changing values in database. But I cannot find in table 'changes' values described if review is ready to submit or not. Where it has been moved?
Also information if all parents are CR+2 is needed. It is possible to find that information in database?

Best regards,
Jacek Ziora

Edwin Kempin

unread,
Jun 16, 2016, 8:45:20 AM6/16/16
to Jacek Ziora, Repo and Gerrit Discussion
On Thu, Jun 16, 2016 at 1:58 PM, Jacek Ziora <jacek.ad...@gmail.com> wrote:
Ok, so if it's not possible to do it automatically, I would like to do this one a day by changing values in database. But I cannot find in table 'changes' values described if review is ready to submit or not. Where it has been moved?
Also information if all parents are CR+2 is needed. It is possible to find that information in database?
This will not work. You may update the change state in the database, but this will not merge the commit into the target branch. Also Gerrit is moving its meta data into git (NoteDb) and the database will go away.
If you want to submit a change, use the REST API for this:

You can also use the REST API to query and set approvals on changes.

 

Best regards,
Jacek Ziora


W dniu środa, 15 czerwca 2016 16:24:46 UTC+2 użytkownik Jacek Ziora napisał:
Hi!

When I want to merge a change, it has to be closed (Code Review +2) and Submitted (with 'parents' of course).

Is it possible to automatically Submit (and merge actually) review when it is given CR+2? Of course only when all parents have also CR+2.

Best regards,
Jacek Ziora

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jacek Ziora

unread,
Jun 16, 2016, 10:05:57 AM6/16/16
to Repo and Gerrit Discussion
Forward back to main discussion.

Thanks for response. I have to do this by ssh, so I used gerrit query to find all changes to submit. But when I use:
ssh -p ${port} ${server} gerrit query status:open is:mergeable

It gives me a lot of commits and they cannot be merged, they aren't even CR+2...

Also I want to submit changes using:
ssh -p  ${port} ${server} gerrit review -p ${project} --submit ${commit_hash}

And when I use gerrit query I have no information about commit hash, I have only changeId, but I cannot use this in gerrit review --submit command.

So what is the best way to find all changes which can be submitted?


2016-06-16 14:47 GMT+02:00 Saša Živkov <ziv...@gmail.com>:
On Thu, Jun 16, 2016 at 1:58 PM, Jacek Ziora <jacek.ad...@gmail.com> wrote:
Ok, so if it's not possible to do it automatically, I would like to do this one a day by changing values in database.
 
Updating change status in database will only update the status. It will not merge the commit in the target branch.
 
But I cannot find in table 'changes' values described if review is ready to submit or not. Where it has been moved?
 
Better use a query to find all mergeable changes. For example: status:open is:mergeable project:X branch:master
You can execute the query via a REST API call [1] or via the SSH query command [2] and submit them using [3] or [4].




Also information if all parents are CR+2 is needed. It is possible to find that information in database?

Best regards,
Jacek Ziora


W dniu środa, 15 czerwca 2016 16:24:46 UTC+2 użytkownik Jacek Ziora napisał:
Hi!

When I want to merge a change, it has to be closed (Code Review +2) and Submitted (with 'parents' of course).

Is it possible to automatically Submit (and merge actually) review when it is given CR+2? Of course only when all parents have also CR+2.

Best regards,
Jacek Ziora

--

Saša Živkov

unread,
Jun 16, 2016, 10:19:46 AM6/16/16
to Jacek Ziora, repo-d...@googlegroups.com
On Thu, Jun 16, 2016 at 4:05 PM, Jacek Ziora <jacek.ad...@gmail.com> wrote:
Thanks for response. I have to do this by ssh, so I used gerrit query to find all changes to submit. But when I use:
ssh -p ${port} ${server} gerrit query status:open is:mergeable

It gives me a lot of commits and they cannot be merged, they aren't even CR+2...
Add additional operator(s) to your query to only search for those which have CR+2, see [5]:

  label:Code-Review+2 label:Verified+1




Also I want to submit changes using:
ssh -p  ${port} ${server} gerrit review -p ${project} --submit ${commit_hash}  

And when I use gerrit query I have no information about commit hash, I have only changeId, but I cannot use this in gerrit review --submit command.

I don't think you must provide a commit hash.
Providing a change-id should be enough:

ssh ... gerrit review <change-id> --submit 




So what is the best way to find all changes which can be submitted?

2016-06-16 14:47 GMT+02:00 Saša Živkov <ziv...@gmail.com>:
On Thu, Jun 16, 2016 at 1:58 PM, Jacek Ziora <jacek.ad...@gmail.com> wrote:
Ok, so if it's not possible to do it automatically, I would like to do this one a day by changing values in database.
 
Updating change status in database will only update the status. It will not merge the commit in the target branch.
 
But I cannot find in table 'changes' values described if review is ready to submit or not. Where it has been moved?
 
Better use a query to find all mergeable changes. For example: status:open is:mergeable project:X branch:master
You can execute the query via a REST API call [1] or via the SSH query command [2] and submit them using [3] or [4].




Also information if all parents are CR+2 is needed. It is possible to find that information in database?

Best regards,
Jacek Ziora


W dniu środa, 15 czerwca 2016 16:24:46 UTC+2 użytkownik Jacek Ziora napisał:
Hi!

When I want to merge a change, it has to be closed (Code Review +2) and Submitted (with 'parents' of course).

Is it possible to automatically Submit (and merge actually) review when it is given CR+2? Of course only when all parents have also CR+2.

Best regards,
Jacek Ziora

--

Björn Pedersen

unread,
Jun 16, 2016, 10:23:41 AM6/16/16
to Repo and Gerrit Discussion
Hi,


Well, submitablility  is really a moving target (something that was submitable during a query may not be anymore, as another change got merged, causing conflicts.).
But maybe https://gerrit-review.googlesource.com/#/c/75676/ could be for you...

Björn

Edwin Kempin

unread,
Jun 16, 2016, 10:30:37 AM6/16/16
to Björn Pedersen, Repo and Gerrit Discussion
On Thu, Jun 16, 2016 at 4:23 PM, 'Björn Pedersen' via Repo and Gerrit Discussion <repo-d...@googlegroups.com> wrote:
Hi,


Well, submitablility  is really a moving target (something that was submitable during a query may not be anymore, as another change got merged, causing conflicts.).
But maybe https://gerrit-review.googlesource.com/#/c/75676/ could be for you...

Björn


Am Donnerstag, 16. Juni 2016 16:05:57 UTC+2 schrieb Jacek Ziora:
Forward back to main discussion.

Thanks for response. I have to do this by ssh, so I used gerrit query to find all changes to submit. But when I use:
ssh -p ${port} ${server} gerrit query status:open is:mergeable
mergeable != submittable

mergeable only means that on git level there are no conflicts for applying this commit to the destination branch (using the submit strategy that is configured on the project)

submittable means that the change is approved and that its predecessors are approved or merged (or all changes with the same topic if the submitTopicTogether feature is enabled).

Jacek Ziora

unread,
Jun 16, 2016, 10:53:02 AM6/16/16
to Repo and Gerrit Discussion, ice...@googlemail.com
When added label:Code-Review+2 it helps.

But I still cannot search submittable changes.

And command ssh ... gerrit review --submit <changeId> does not work:
fatal: "I824937d0a3222d590a82b05022ba6347387fd344" is not a valid patch set

Saša Živkov

unread,
Jun 16, 2016, 10:58:20 AM6/16/16
to Jacek Ziora, Repo and Gerrit Discussion, Björn Pedersen
On Thu, Jun 16, 2016 at 4:53 PM, Jacek Ziora <jacek.ad...@gmail.com> wrote:
When added label:Code-Review+2 it helps.

But I still cannot search submittable changes.

And command ssh ... gerrit review --submit <changeId> does not work:
fatal: "I824937d0a3222d590a82b05022ba6347387fd344" is not a valid patch set

Ah, it should be change-id,patch-set 
Use the --current-patch-set option to include the information about current patch set in the output.

Jacek Ziora

unread,
Jun 16, 2016, 11:03:16 AM6/16/16
to Repo and Gerrit Discussion, jacek.ad...@gmail.com, ice...@googlemail.com
But there is no such option in gerrit review command...

You probably meant gerrit query command, but it doesn't do what I need. :(

Saša Živkov

unread,
Jun 16, 2016, 11:14:04 AM6/16/16
to Jacek Ziora, Repo and Gerrit Discussion, Björn Pedersen
On Thu, Jun 16, 2016 at 5:03 PM, Jacek Ziora <jacek.ad...@gmail.com> wrote:
But there is no such option in gerrit review command...

I meant gerrit-query command.

You probably meant gerrit query command, but it doesn't do what I need. :(
And what do you need? 

Jacek Ziora

unread,
Jun 16, 2016, 11:49:06 AM6/16/16
to Saša Živkov, Repo and Gerrit Discussion, Björn Pedersen
I need to submit (merge) my change(s). Gerrit query can do this? I understood, that this command gives me only information about changes in database.
Reply all
Reply to author
Forward
0 new messages