Viewing diffs in reviewboard

As a senior programmer, I do a lot of code reviews. We use reviewboard for that, which is awesome. It really seems to have increased the code quality, reduced bugs and has built a standard on how certain stuff is done.

A review can have multiple iterations, these are called diffs. So if someone uploads a patch, and he gets comments, he uploads a new patch. When this happens you can see the difference between the first thing he uploaded, and the second. So you don’t have to review all the code again.

Anyway, there was one little thing that was bugging me about the interface. When you’re looking at the second diff uploaded, and you decide you need to compare the first diff to the third, you first need to go to the third diff, and then you can select to compare it with the first diff. So, I basically decided to add a pulldown there.

The left is the before, the right is the end result. This probably seems like a small detail, but details matter.

The setup

From an almost vanilla Ubuntu 12.10, this is what I had to do to get review board up and running. I got this information from the getting started page, combined with the installing on linux page.

$ sudo apt-get install patch git python-setuptools python-sqlite
$ sudo easy_install virtualenv
$ mkdir reviewboard
$ virtualenv reviewboard
$ cd reviewboard
$ source bin/activate
$ easy_install nose Sphinx
$ git clone git://github.com/djblets/djblets.git
$ cd djblets
$ python setup.py develop

This was the first command that gave an error: a gcc fail with the error “_imaging.c:75:20: fatal error: Python.h: No such file or directory”. At a guess I installed the python-dev package, and that fixed the problem. So, time to get the actual source code then!

$ cd ..
$ git clone git://github.com/reviewboard/reviewboard.git
$ cd reviewboard
$ python setup.py develop
$ python ./contrib/internal/prepare-dev.py

This prompted me to create a new “Django super user”, which I did. After that it told meĀ Your Review Board tree is ready for development.

This was not true, since I also needed RBTools

$ git clone git://github.com/reviewboard/rbtools.git
$ cd rbtools
$ python setup.py develop

After that I was able to run the code of reviewboard with

$ cd ../reviewboard/
$ ./contrib/internal/devserver.py

That worked. Even got the code for the upcoming reviewboard 1.7, which is looking really good! Time till it was running: 1 hour.

The coding

So, how is reviewboard built? It uses MVC, jQuery, python, Less CSS, and Django. I’m very familiar with the first two. It’s been a long time, but I’ve programmed in python before. So the only new technologies were Less CSS and (mainly) Django. Being completely unknown to the code of reviewboard, I started with the most reasonable thing: a full text search. That struck gold, since there were only two matches!

Fast forward two hours: posted a review that fixed the thing I wanted to fix.

Leave a Reply

Your email address will not be published. Required fields are marked *