Community
Participate
Working Groups
The Gerrit Connector currently desn't have support for optional parameters in the gerrit changes query. For example, to implement the Gerrit Dashboard efficiently, it would be useful to pass the "LABELS" option to the changes query in order to obtain the information needed to populate the "Code-Review" and "Verified" fields. The alternative is to perform requests for review change details and extract the relevant information - a time consumming operation that requires a trip to the back-end for each review. A simple solution would be to augment the GerritClient API to optionally support query options. Although the "LABELS" option is of immediate use, the full set of options is quite interesting (hence this bug for some kind of generic support).
From the gerrit REST API documentation, the general form of the changes query request is roughly: GET /changes/?q=<some query>&o=<options>&n=<limit> where the parameters 'o' and 'n' are optional. For example (from http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/rest-api-changes.html#change-endpoints): GET /changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS HTTP/1.0 HTTP/1.1 200 OK Content-Disposition: attachment Content-Type: application/json;charset=UTF-8 )]}' [ [ { "kind": "gerritcodereview#change", "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57", "project": "demo", "branch": "master", "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57", "subject": "One change", "status": "NEW", "created": "2012-07-17 07:18:30.854000000", "updated": "2012-07-17 07:19:27.766000000", "reviewed": true, "mergeable": true, "_sortkey": "001e7057000006dc", "_number": 1756, "owner": { "name": "John Doe" }, "labels": { "Verified": {}, "Code-Review": {} } } ], [], [] ]
Proposed fix pushed to gerrit (9ab99bc) GerritClient.executeQueryRest() is responsible for formatting the query string (uri). The proposed solution is to augment its API with an optional optionString. It is fairly simple to ensure backward compatibility for the existing code by overloading a couple of methods. Note that this solution only applies to the REST API (gerrit 2.5+).
(In reply to comment #0) > For example, to implement the Gerrit Dashboard efficiently, it would be useful > to pass the "LABELS" option to the changes query Does it mean this bug blocks bug 414253 ?
> > Does it mean this bug blocks bug 414253 ? Yes. I added the dependency.
(In reply to comment #2) > Proposed fix pushed to gerrit (9ab99bc) It' https://git.eclipse.org/r/#/c/15044/ > Note that this solution only applies to the REST API (gerrit 2.5+). That's too bad. Any chance to produce the same output for 2.4 (it's still supported)? Also, see my comments on the review.
I think all reviews related to this bug have been merged. Thanks!