Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Revert to older patch set version via the Gerrit UI?

Tags:

gerrit

If I have multiple patch set versions for one change in Gerrit, it seems like I can only submit the latest patch set version (because only that one has the necessary button). Is there an easy way to instead submit one of the old patch set versions of the same change, using only my web browser on that Gerrit instance?

I know that I can fetch the wanted version of the patch set from my git client and push it as yet another new patch set version on top, but I would like to avoid having identical patch set versions multiple times in the review and discussion around it.

like image 491
Bananeweizen Avatar asked Jul 06 '12 05:07

Bananeweizen


People also ask

How do I revert a patch set in Gerrit?

Cherry-pick the specific "patch set" of the "change list" (e.g. if there are 15 patch sets in a Change List and want to revert back to patch set #8). Get the cherry-pick command from Gerrit UI for the required patch set. Run that cherry-pick command, and use git commit --amend , then push your change.

What is patch set in Gerrit?

Gerrit uses the Change-Id to associate each iteration of the commit with the same change. These iterations of a commit are referred to as patch sets. When a change is approved, only the latest version of a commit is submitted to the repository. It is also possible to copy a Change-Id to a completely new commit.

How do I edit a commit in Gerrit?

You can modifiy the commit message from gerrit UI directly. Just open the commit message on gerrit and click on the edit button next to patch-sets on the above. Do any change and then save it. You will need to submit you new commit message afterwards, appearing just above the owner section on the commit page.


2 Answers

No, sorry, this is not currently possible. The design assumes that the most recent patch set is the one developers will review and test, and as such older patch sets can not be submitted. They also can not be reviewed/verified. If you want to use an older version of a patch set, you must re-submit it to make it the most recent patch set. To avoid no new changes error do git commit --amend and git will create a new sha1, which will be happily accepted by Gerrit as a new patch set.

like image 184
Brad Avatar answered Oct 11 '22 12:10

Brad


There is no proper way to do this using only Gerrit UI. Cherry-pick the specific "patch set" of the "change list" (e.g. if there are 15 patch sets in a Change List and want to revert back to patch set #8). Get the cherry-pick command from Gerrit UI for the required patch set.

Run that cherry-pick command, and use git commit --amend, then push your change. It will generate new patch set (for above example #16).

like image 37
sbodd Avatar answered Oct 11 '22 13:10

sbodd