Tip #3: Make Life Easier for Your Code Reviewer

There are probably a hundred applications that will package up code changes in various cool ways.  You could also write your own -- unfortunately it's one of those cases where the time you save using the tool will never approach the time you spent making the tool. 

I get code review requests fairly often and they are almost always like this:

 Below are the diffs for my change.  Please review

 And as promised the output of some diff tool is below in the email.  What if the context around the diffs isn't big enough?  What if I hate the diff tool formatting?  What if I want to compile and run the actual changes in my environment?

I can't do any of the above quickly and easily with the raw diffs embedded in the email.  Even copying and pasting them is usually a big pain because of the prepended plus signs.

 Here are my requirements for code review submitters (Please?!?)

  • Send out the actual changed source files
    • Make it very very easy to get those source file into the right directory.  Don't make me type in commands with endlessly long paths!
  • Send me the diffs as a file and have it appear directly in the email (maybe the change is easy and I don't need to waste time dealing with file attachments)

And here is the solution I use.  It is simple and old-fashioned and works great:

  1.  Create the following script (Windows version).  I use this script constantly when I'm working on source code.  That's why I named it "s.bat".  Usually I don't use the "dome.bat" file but I always create it just in case.  I sort the output to get all the modified files together.

    svn status | sort | tee dome.bat

  2. To submit the changes to a code reviewer, I want him or her to get the diffs file, and all changed files.  I collect the diffs in a file like so (make a script out of it!)
    svn diff > diffs.txt
  3. Here is the trick.  Edit the dome.bat file from step 1 above.  Delete the uninteresting lines and QUICKLY edit the Modified or Added lines to do this:
    jar cvfM mychanges.jar diffs.txt c:/some/gigantic/ugly/long/path/foo.java c:/some/even/uglier/gigantic/long/path/foo2.java
  4. Now I attach mychanges.jar to an email and also copy the diffs to the email message.  I tell the reviewer which directory to change to and how to unpack the source files.  E.g.
    "cd to core/kernel and run jar xvf mychanges.jar to overlay my changes in your installation"


It sounds like a big deal but it shouldn't take more than a couple minutes and it makes life more pleasant for the reviewer.  Note how the reviewer can do this:

jar cvfM temp.zip src
jar xvf mychanges.jar
run his or her favorite diff tools
compile and build, look at the code in a debugger or whatever
when review is complete, jar xvf temp.zip


Comments:

Long Path Tool is very useful if you are having problems in deleting, unlocking, copying and even renaming files that are considered filename too long by your system. Yes, these problems can occur even while using the latest Windows Explorer or FAR in managing your files. This tool can help you simplify files names that are categorized as filename too long by your system.

Posted by guest on December 18, 2011 at 01:30 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

ByronNevins

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today