The past few days I moved the development of TestApi to the Codeplex TFS servers. Previously, we used to develop TestApi in the internal WPF branch at Microsoft, which had become a bit of a drag due to the need to support contributors from various teams across the company.
As part of the move, I needed to set up a code review process. Turns out that it’s a bit of a struggle to figure out how to set up a simple CR process using standard tools – mostly due to poor documentation – so I thought I’d share what I did in this post. Hopefully, that will save someone out there some time.
The general CR process goes as follows:
The tools we use for CR are VS 2010 itself and WINDIFF. The latter is a diffing tool used for step 2 of the CR process.
To set up WINDIFF as your diff-ing tool, in VS 2010 go to Tools > Options…, scroll down to the Source Control item and configure your compare tool to be WINDIFF as shown below:
Shelving is the act of storing pending changes on the TFS server (see this link for more). To create a shelveset, in Source Control Explorer, right-click on the folder, containing all pending changes, and choose Shelve Pending Changes… in the displayed context menu. This will bring up a dialog that you can use to shelve your changes.
Once you shelve your proposed changes, send an email to the code reviewer, with your username and the name of your shelveset.
When you get a CR request, go to File > Source Control > Unshelve Pending Changes… and in the displayed Unshelve dialog, discover the shelveset that you need to review and click Details…
In the displayed Shelveset Details dialog, right click the file you want to review and compare it to its unmodified version. This will trigger WINDIFF as a comparison tool. Record your comments in an email and send them back to the developer (or approve the checkin if you agree to it).
That’s pretty much it. Obviously, this is a poor man’s solution, but it’s certainly better than nothing. There are a bunch of more advanced solutions out there providing code annotation, review workflows, etc. that you may find valuable too. This post by JB Brown may be a good starting point for those who want to go further.