How to delete submitted CLs to re-upload again and avoid change-Id clash?

56 views
Skip to first unread message

Adithya Gajulapally

unread,
Jul 9, 2024, 7:25:17 PM (13 days ago) Jul 9
to Repo and Gerrit Discussion
We have a project in which around 44 CLs were pushed for review (together) to a new branch, +2ed, and submitted. These were incorrect ones (many are cherry-picks from other branches). So, we reset the branch pointer back to before these changes, and we want to upload a subset of these CLs mixed in with other correct CLs. Unfortunately, Gerrit is not allowing pushing them for review since change-Ids clash.

We want to remove the old CL review information to push these CLs again. Is this possible?  The branch is not under active development and is a new branch; hence, we can redo all the commits if needed. We can't change the branch name. Looking at NoteDB format, we may have to delete a bunch of stuff from Gerrit's git folders under refs/changes/<last 2 digits>/<CL number>; reindex and maybe even update the H2 db file (I don't know how). Has someone ever done this before, or is there a plugin that can delete a bunch of CLs? Our Gerrit version is 3.9.5. Thanks!

Martin Fick

unread,
Jul 9, 2024, 8:38:11 PM (12 days ago) Jul 9
to Adithya Gajulapally, Repo and Gerrit Discussion
On Tue, Jul 9, 2024 at 5:25 PM Adithya Gajulapally <adithya.g...@gmail.com> wrote:
We have a project in which around 44 CLs were pushed for review (together) to a new branch, +2ed, and submitted. These were incorrect ones (many are cherry-picks from other branches). So, we reset the branch pointer back to before these changes, and we want to upload a subset of these CLs mixed in with other correct CLs. Unfortunately, Gerrit is not allowing pushing them for review since change-Ids clash.

We want to remove the old CL review information to push these CLs again. Is this possible?  The branch is not under active development and is a new branch; hence, we can redo all the commits if needed. We can't change the branch name. Looking at NoteDB format, we may have to delete a bunch of stuff from Gerrit's git folders under refs/changes/<last 2 digits>/<CL number>; reindex and maybe even update the H2 db file (I don't know how). Has someone ever done this before, or is there a plugin that can delete a bunch of CLs? Our Gerrit version is 3.9.5. Thanks!

You can delete changes via Gerrit (no need to mess with the refs) https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#delete-change

I do think it would be nice if Gerrit detected that a "merged" change was not on its branch and offered a "re-open change" button for cases like this when viewing such a change,

-Martin

Adithya Gajulapally

unread,
Jul 15, 2024, 12:34:37 PM (7 days ago) Jul 15
to Repo and Gerrit Discussion
Hi Marin,

I just wanted to let you know that your suggestion only works for unmerged changes. Once merged, the only way to delete is to remove the refs from NoteDB after taking Gerrit down and re-indexing before starting up Gerrit again. Assuming you want to delete CL number 2078, you need to delete all patch sets and the metadata. The commands we used for this example are below. They worked for us, but we don't know if there will be any side effects in the future.

git update-ref -d refs/changes/78/2078/1
git update-ref -d refs/changes/78/2078/meta

Regards,
Adithya
Reply all
Reply to author
Forward
0 new messages