Michael Dorner
Michael Dorner

Reputation: 20155

Collect all Gerrit reviews

For my current research, I want to gather all closed reviews from Gerrit instance, e.g from Gerrit itself.

My first attempt was to go via the REST API. However, there is a limit for queries, set by the Gerrit administrator. So I cannot collect all reviews and it is quite slow for large instances.

There would be a tool, namely Perceval, but this requires SSH access, which I do not have, obviously.

So I think I need to go over git. As far as I understood, all reviews/changes under review are stored in refs/changes/....

So I

git ls-remote https://gerrit.googlesource.com/gerrit | grep /changes/ | awk '{print $2;}' 

which lists all heads:

...
refs/changes/99/99999/3
refs/changes/99/99999/4
refs/changes/99/99999/5
refs/changes/99/99999/meta
...

Then I can iterate through this list. But

git fetch https://gerrit.googlesource.com/gerrit refs/changes/99/99999/meta

does not work.

I also tried to mirror the git repository with

git clone --mirror https://gerrit.googlesource.com/gerrit

but this does not include the changes folder.

Am I on the wrong track? What can I do instead? Of course, completely new ideas are also welcome!

Upvotes: 1

Views: 562

Answers (2)

pratt
pratt

Reputation: 1813

This works for me:

git fetch origin +refs/changes/*:refs/remotes/origin/changes/*

I haven't tried it for public Google Gerrit instance but it works for private Gerrit instance used in our company.

Maybe somebody find it useful.

Upvotes: 1

Michael Dorner
Michael Dorner

Reputation: 20155

Unfortunately, my approach is not possible - yet. As the documentation states:

Although an effort is underway to eliminate the use of the database altogether, and to store all the metadata directly in the git repositories themselves. So far, as of Gerrit 2.2.1, of all Gerrit’s metadata, only the project configuration metadata has been migrated out of the database and into the git repositories for each project.

So I hope there will be a solution in the future.

Upvotes: 1

Related Questions