One of my potential research experiments involves augmenting ReviewBoard
, and so, I’ve been studying the ReviewBoard code.
I want to give ReviewBoard the ability to record certain statistics – for example, the number of defects in a review request, number of defects found per reviewer, defect density, inspection rate, etc…
It turns out I’m not the only one who wants this to happen. Check out this thread.
So it turns out that the devs building ReviewBoard are planning on integrating an extension framework. Theoretically, users could then write their own extensions to customize ReviewBoard as they see fit. Think WordPress plugins, but for a code review tool. Neat.
According to the above link:
A lot of this [extension framework] already exists in a private development branch, and it will be one of our primary focuses as soon as 1.0 goes out.
However, I found the following quote from a relatively recent mailing list message:
[with regards to the extensions framework]…We have to finish building it, testing
it, getting other features we have planned into the release, and performing
the release. So, we’re looking at a year or more. But I don’t see how we’d
get the functionality you want short-term.
Hrmph. My thinking: maybe I can help them with it, and we can crank this puppy out sooner.
So where is this private branch? It actually took a little bit of detective work…
I started by looking at the ReviewBoard repo on Github, which I assumed that the extensions branch would fork from.
I was right – check out the fork network. There’s a branch helpfully labeled “extensions” forked by davidt, one of the ReviewBoard devs.
- This fork hasn’t been updated in about a month
- The extensions stuff references stuff from Djblets which doesn’t exist in the Djblets master branch
So I perform the same exercise – I glance at the Djblets fork network, and see the handily named “extensions” fork that is in davidt’s git repo. Nice.
Ok, so those are the forks/branches that I’m going to grab.
So, funny story: I was able to get this “extension” version of ReviewBoard working on my work machine. But it was by a complete fluke – this extension version of Djblets is actually missing some pieces. The only reason it worked for me was because I accidentally ran with the master checkout of Djblets first. This errored out, and also generated a bunch of compiled Python. I then switched to the extensions branch, which left the compiled Python behind. The compiled Python filled all of the missing pieces that are in the extensions branch of Djblets, and so it ran.
For a guy who is pretty new to both Git and Django, I found that problem pretty frustrating to track down. Especially when I started writing up the checkout instructions… big thanks to Zuzel for her invaluable (and patient) Django guidance.
Anyhow, if you’re interested in the steps to failure, here they are…
Setting Up (for failure)
I’m running Ubuntu Karmic. I have Git installed.
- First of all, this document is invaluable
- Check out django_evolution from SVN to some local directory
- Put path to django-evolution into PYTHONPATH (export PYTHONPATH=$PYTHONPATH:/…/django-evolution-read-only/)
- Get Python Setuptools (sudo apt-get install python-setuptools)
- With easy_install, get nose, paramiko, recaptcha-client, Sphinx (sudo easy_install nose paramiko recaptcha-client sphinx)
- Clone original master Djblets repo (git clone git://github.com/djblets/djblets.git) and CD into djblets directory
- Add davidt’s remote Djblets branch (git remote add davidt git://github.com/davidt/djblets.git)
- Fetch davidt’s repo (git fetch davidt)
- Track davidt’s extension branch for djblets (git branch extensions davidt/extensions)
- In djblets root dir, type: sudo python setup.py develop
- This should install Django too. The ReviewBoard install doc says to install from Subversion, but this will do for now.
- Clone ReviewBoard git repo (git clone git://github.com/reviewboard/reviewboard.git) and Cd into it
- Add davidt’s remote Reviewboard branch (git remote add davidt git://github.com/davidt/reviewboard.git)
- Fetch davidt’s repo (git fetch davidt)
- Track davidt’s extensions branch of reviewboard (git branch extensions davidt/extensions)
- Switch to extensions branch (git checkout extensions)
- So reviewboard/reviewboard/extensions should have stuff in it.
- python ./contrib/internal/prepare-dev.py
- Manually create the directory reviewboard/reviewboard/htdocs/media/ext. ReviewBoard expects it and will complain if it isn’t there.
- Run ./contrib/internal/devserver.sh
- Go to localhost:8080
If you’re like me, you’ll see an error about “no module named urls”. This is because the extension branch of Djblets is missing urls.py in its djblets/log directory. As you can see, urls.py exists in the master Djblets branch.
So I’ve accidentally got it running. But this version of ReviewBoard I’ve created is like Frankenstein’s monster – it’s a sad, stitched together monstrosity that should probably never see the light of day.
I tried to merge the master branch of Djblets and ReviewBoard into the extensions branch, and then realized that I had no idea what I was doing. The last guy you want doing a merge is a guy who doesn’t know what he’s doing.
So that’s where I stand with it. Kind of a sad affair, really. I’ve posted on the ReviewBoard developer mailing list asking for some guidance, but all is quiet so far.
In the meantime, I’ll continue studying the code when I can. The extensions stuff is actually pretty far along, in my opinion – but what do I know, I’ve never built one. I’ll also take a peek at some other examples of extension frameworks to see what I can learn about implementation (that’s right – I’m talking about you, WordPress).
I’ll let you know what I find.