Webrev revised

I recently putback a bunch of work on webrev, a tool which produces HTML-based code reviews.  webrev is much older than web-2.0 generation tools like Google’s Mondrian and other commercial code review tools I have seen, but it has done a good job for us for many years.   That said, webrev has built up a long "wish list" of improvements that folks would like to see, evidenced by the dozen or so RFEs about webrev I found in our bug database.  Another problem is that a lot of folks at Sun have been using hacked up versions of webrev for many years, leading to a proliferation of different versions.  As I started working my way through these, I set the goals of my project as follows:

  • Improve the functionality to encompass common wish-list items
  • Clean up the implementation in preparation for Subversion and Mercurial support (which other folks have been prototyping)
  • Redo the command line interface so that simply invoking ‘webrev’ from the command line attempts to do something useful; rework the options processing to be more extensible and add new options.

Once I talked things over on tools-discuss@opensolaris.org and got some additional suggestions I finished the implementation and putback the fixes. You can see the results here: [old webrev] [new webrev]. Here is the heads up message I sent out about the work, and a quick rundown of the changes I made:

  • You can now run ‘webrev’ standalone and expect it to "just work." If you have ‘wx’ initialized, it will use that. If not, it’ll use Teamware (and soon, Mercurial and Subversion).
  • Webrev now emits a GNU-patch compatible patch of the changes and a PDF version of the codereview.
  • An "OpenSolaris" mode is now present: use it via ‘wx webrev -O’ or ‘webrev -O’.
  • As might be obvious from the above point, wx now passes arguments to ‘wx webrev’ on through to webrev.
  • The command line output has changed. Here is a sample:
    $ webrev
    SCM detected: teamware
    File list from: 'wx list -w' ... done
    Workspace: /builds/dp/webrev-fixes
    Compare against: /ws/onnv-clone
    Including: /builds/dp/webrev-fixes/webrev-info
    Output to: /builds/dp/webrev-fixes/webrev
    Output Files:
    patch cdiffs udiffs wdiffs sdiffs frames ps old new
    patch cdiffs udiffs wdiffs sdiffs frames ps old new
    Generating PDF: Done.
    index.html: Done.
  • Teamware-only operation (i.e. when wx is not present) is improved. For example, you can now easily compare the gate against the clone:
         CODEMGR_WS=/ws/onnv-gate webrev -p /ws/onnv-clone -o ~/gatechanges

I also made these improvements:

  • Improved man page
  • Implemented a common color scheme and visual design
  • Delta comments are now shown at the top of each file
  • Printing support via media=print stylesheets
  • Support for generating webrev against previous webrev
  • Overhauled command line parsing including new options:
    • -o <outputdir>
    • -i <include-file>
    • -p <compare-against>
    • -w <wx-file>
    • -O [OpenSolaris mode]
    • -l <options to putback>
  • Cleaned up and improved index.html page.
  • XHTML compliance (or close)

I’m optimistic that folks beyond Sun will find the new webrev useful, particularly once we
get Subversion and Mercurial support dropped in.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s