If you’re a Review Board or RBCommons user, you’re probably familiar with RBTools, our handy set of command line tools for working with Review Board. (If you’re not using RBTools, I’m going to tell you how to get started with it in a bit.)
You’re probably most familiar with
rbt post, or
post-review in older versions. This is the tool that helps you quickly get a change onto Review Board, or to update an existing review request. It’s pretty handy, but how much do you really know about it? Or about the other commands included with RBTools? (Yes, there are others!)
I’m going to show you five of my favorite tips and tricks for RBTools that you may not know about.
5. Opening a browser after posting with
rbt post -o
When you run
rbt post, you usually get something like this:
$ rbt post
Review request #123 posted.
Those links for opening the review request or diff are useful, but you can save yourself a step by having RBTools open your browser for you. Just pass
rbt post, like so:
$ rbt post -o
Your browser of choice will open, ready for editing. Want to do that automatically, every time? Add this to your
.reviewboardrc in your home directory:
OPEN_BROWSER = True
4. Check your open review requests with
At some point or another, you’ll want to see what review requests you have open, either as a draft or currently pending review. I myself need to do this at times to help me remember if I’ve already posted something for review.
Sure, you could dig through the dashboard and check. That works great, but it means leaving the command line. That’s where the
rbt status command comes in:
$ rbt status
r/6676 - Add release notes for Review Board 2.0.12.
r/6258 - Add release notes for Review Board 2.1 beta 1.
rbt status will show you all open review requests for the current repository – their IDs and their summaries. Pass
--all and it’ll show you all open review requests across all repositories.
3. Attach files to review requests with
Review Board makes it pretty easy to drag-and-drop files onto a review request in order to quickly upload them, but it does mean having the file manager and web page open. If you’re a command line junkie like me, you’d probably rather avoid that as much as possible.
rbt attach will let you upload a file to a review request with a single command. Just give it the review request ID, the file to upload, and an optional caption, and you’re done.
Let’s try it.
$ rbt attach 123 screenshot.png
Uploaded screenshot.png to review request 123.
Want to give it a caption?
$ rbt attach --caption "UI screenshot" 123 screenshot.png
2. Apply a review request’s diff to your tree with
If you’re an open source developer, or you like to thoroughly test other people’s patches as part of reviewing their code, then this tip is for you.
rbt patch pulls down the latest patch (or a specified revision) from a review request and applies it to your tree. It can even create a commit for that patch, if using Git or Mercurial, by running
rbt patch -c.
$ rbt patch -c 123
Changes committed to current branch.
We use this when accepting contributions from our own Review Board server. After a thorough review, we run
rbt patch -c, edit the commit message as appropriate, and push it.
As a bonus, this will append a
Reviewed at <url> line to the bottom of the commit message. If you’re using repository hooks to auto-close review requests (admins, see the “Hooks” link next to a repository in the administration UI), pushing this commit will take care of closing that out for you.
1. Easily update review requests with
rbt post -u
If you’ve been using RBTools for a good long while, you’re probably used to passing
-r <ID> to
rbt post, in order to tell it which review request to update. This means having to look up the ID and making sure you don’t type it wrong.
In RBTools 0.6 or newer, we have a much simpler solution. Just pass
-u. RBTools will automatically find a matching review request, asking if it’s not completely sure it’s a match, and update it for you. Let’s compare:
$ rbt post -r 123
$ rbt post -u
It’s much nicer. Get in the habit of using
-u. It’s the wave of the future.
What if I’m not using RBTools?
Seriously, RBTools is the best way to get the most out of Review Board. You can follow our installation instructions to get started. We’ll soon be announcing new installers to make this easier.
The RBTools documentation is a great resource. You can learn about all the RBTools commands, our Python API for interfacing with Review Board, configuration options, and more.
We’ll be posting a new batch of tips and tricks for RBTools soon, plus some advanced Git and Review Board tips.
If you’re not already on our mailing list, subscribe today to keep up with the latest releases, tips, and strategies.
And now, we’d like to leave you with this: