Re: Review Board API

36 views
Skip to first unread message
Message has been deleted

Matthew Woehlke

unread,
May 23, 2013, 3:16:43 PM5/23/13
to reviewb...@googlegroups.com
On 2013-05-19 20:32, Django Son wrote:
> I am currently trying to understand the Web API. I noticed that you can use
> 'post-review' on a git repo to have a review auto-generated on your Review
> Board website. However, a review number gets automatically generated when a
> review request is created (For example localhost:8080/r/5). What is the
> best approach to programatically determine what the review number of your
> current repo is after you have already created a review request for it
> through 'post-review'?

I haven't found a great way to do this yet.

I have a git-rb wrapper for post-review that, among other things, parses
the post-review output to find the review number, and then sets it as a
git config attribute on the branch that was posted. If you write a
python wrapper there is probably an even more direct approach. However,
this only helps with the specific checkout that was used to post the
request.

The "right" way to do this is to add a field to RB to have the git SHA
that was posted, so that one can later go through the requests to look
for a matching SHA. Or find a way to coax RB into allowing the SHA to be
put in the changenum field for git requests. (Better if there is a way
to do something like 'SELECT ID FROM REQUESTS WHERE CHANGENUM IS <SHA>',
but not sure if RB supports that.)

It would also be useful to have an additional field with the name of the
branch as pushed to the 'master' repository.

As I understand this is on the feature plan for 1.8. Not sure if it is
possible yet to write an extension to do this in 1.7.x. (If you
have/write one, I would like it, please!)

> Also, how do you extract the issue summary from the
> web api. I noticed that a GET request to /api/review-requests/5/ would
> review all the fields of the review request. However, the issue summary is
> not there nor can I find it under any specific review /5/reviews/4/?

The git-rb I wrote does this, but depends on
http://reviews.reviewboard.org/r/3733/ which has not been ported to the
current API. There is expected to be an 'rbt query' command coming along
at some point which will be a more fully featured version of this.
Meanwhile you can look at what I wrote and hopefully deduce how to do
what you want via RB's Python API.

--
Matthew
Reply all
Reply to author
Forward
0 new messages