Using Bazaar with Rietveld for Code Reviews | Comments (0)
Posted in Code, Software on 13th February 2009, 1:31 am by Stuart
I’ve been trying out Rietveld lately as I needed a standalone tool for being able to quickly review code for various apps I’m collaborating on. Rietveld is a Google appengine application for code reviews written by Guido van Rossum. Rietveld is fairly basic, but for carrying out code reviews I can’t see that you need much more than the commenting features it provides.
All you need to create a new review is a diff of some code. Reviewers can then provide comments for each line of the code up for review. Once they have finished their review they then have to submit their comments which are then sent to the reviewee by email and are subsequently made public on the site for everyone to view.
If you’re using google apps for your domain it’s also possible to set-up your own instance of rietveld via a cname DNS entry pointing at ghs.google.com. this is a very nice feature in terms of making it very easy to add a code review service to your organisation.
Getting code into Rietveld
There’s several methods for getting code into Rietveld including a form upload, some support for pointing Rietveld at SVN branches. My favorite method is to use the “upload.py” file available on the “create issue” page to upload diffs for review.
The current version of upload.py has support for svn, git and mercurial. Separately someone had already written an integration for bazaar that I found via issue #83 on the rietveld issue tracker.
I tried out this integration and found that it didn’t work unless you were at the top of a branch so I’ve modified it so that it now works from any point in the branch by working out the path based on the output of the bzr root command. I’ve verified that it works for single files as well as uploading diffs for multiple files. My updated version of upload.py can be found here http://codereview.appspot.com/17053 where I’ve annotated the main differences between my version and the one belonging to review #14053.
To use upload.py with bazaar support first get hold of an up to date copy of upload.py from the create issue page and patch it with the following diff e.g:
patch -p0 ~/bin/upload.py issue17053_1002_5.diff
Alternatively, you can grab a working copy of upload.py with bazaar support from here. Though be sure to check that there’s not already a more up to date copy available from google before doing so.
Using Upload.py
To upload a diff for a specific file run:
upload.py --rev=<revno> <file>
To upload a diff of your entire branch change directory to the branch root and run:
upload.py --rev=<revno>
If you’ve got your own rietveld instance use the -s flag to point upload.py at your instance:
upload.py --rev=<revno> -s codereview.example.com
Note: I hit another issue with upload.py which is recorded here: issue #81. The symptoms of this was that uploading fails if you use the upload.py that’s available from codereview.appspot.com to upload to a hosted instance.
My patch with modifications for bazaar incorporates a fix for this. If you aren’t using bazaar and want to use upload.py with both codereview.appspot.com and your own hosted version the fix that worked for me can be found here: issue #17052

