Archive for April 17th, 2008

When SCM meets Web 2.0 – Cool Widget at Orbitz

April 17th, 2008

In my role as an AccuRev Systems Engineer, I have the welcome opportunity to visit many companies looking to find a better software configuration management (SCM) tool, as well as many companies who have already achieved that goal by choosing AccuRev. I run into various degrees of sophistication, from those that were previously versioning their source by creating .bak directories to those that have embraced modern capabilities and are truly stretching their SCM environment beyond anything previously achievable.

One of the coolest examples I’ve ever seen of the latter is at Orbitz. I’m sure you’re familiar with the travel giant, and they use AccuRev to manage the source code behind their heavily visited website. Their team is full of highly skilled and intelligent people and they are definitely one of the most advanced AccuRev shops I’ve had the pleasure of working with.

While visiting them recently, I was very impressed with a component of an intranet wiki they showed me. They were actually running RSS feeds from AccuRev streams! There are a number of practical applications for this kind of functionality, but first and foremost it allows you to keep teams up to date on changes being made in the codebase. So you can subscribe to various collaboration streams in your project, as well as perhaps “watching” other streams that you might have interest in. This can also provide support for a continuous code review process. Leads on a project can easily review the code that is created during the project by watching the stream that the team is working in. By doing this review over the lifetime of the project, they can more easily give feedback earlier in the process. And since the feeds are simply aggregated as they arrive, they can decide when the best time to check out the changes are.

How is this done? Well, with AccuRev’s command-line it’s actually a lot easier than you might think. Their RSS feeds are generated from a Rails app they have written for internal use. Getting the initial feed is quite easy. The user’s feed reader hits a URL that includes the stream they are watching. This URL is parsed by Rails and sent to a Rails controller that queries for the last 20 transactions in that stream:


[snip]
Parameters: {“format”=>”atom”, “action”=>”hist”, “id”=>”orbitz-api-foo-ci”, “controller”=>”accurev”}
Accurev command (1.226238): accurev ’show’ ’streams’ ‘-fix’ ‘-s’ ‘orbitz-api-foo-ci’ ‘-fx’
Accurev command (0.592468): accurev ‘hist’ ‘-s’ ‘orbitz-api-foo-ci’ ‘-t’ ‘now.20′ ‘-fx’
Accurev command (1.195955): accurev ’show’ ’streams’ ‘-fix’ ‘-s’ ‘orbitz-api-foo-ci’ ‘-fx’
[snip]

Once that information is loaded, they render an Atom feed to summarize the transaction information. Items like transaction type, user, comments, and number of files are displayed. Additionally, building a page that summarizes the transaction lets them show file status like modified, added, or removed. A tiny bit more complicated, but again can be easily accomplished with AccuRev CLI. Here’s a snippet of that processing:


[snip]
Parameters: {“stream”=>”orbitz-api-foo-ci”, “action”=>”transaction”, “id”=>”4587″, “controller”=>”accurev”}
Accurev command (0.937849): accurev ’show’ ’streams’ ‘-fix’ ‘-s’ ‘orbitz-api-foo-ci’ ‘-fx’
Accurev command (0.356075): accurev ‘hist’ ‘-s’ ‘orbitz-api-foo-ci’ ‘-t’ ‘4587.1′ ‘-fx’
Accurev command (0.603777): accurev ‘hist’ ‘-fx’ ‘-p’ ‘orbitz-api-foo’ ‘-k’ ‘defunct’ ‘/./build.xml’ ‘/./foo.txt’ ‘-fx’
Accurev command (0.333936): accurev ‘anc’ ‘-p’ ‘orbitz-api-foo’ ‘-v’ ‘orbitz-api-foo-ci/3′ ‘-1′ ‘/./foo.txt’ ‘-fx’
Accurev command (0.357128): accurev ‘anc’ ‘-p’ ‘orbitz-api-foo’ ‘-v’ ‘orbitz-api-foo-ci/44′ ‘-1′ ‘/./build.xml’ ‘-fx’
[snip]

Finally, that summary page provides the ability to view the file contents and run diffs. Here’s a sampling of how the unified diff gets generated:


[snip]
Parameters: {“eid”=>”56″, “action”=>”view_diff”, “previous_version”=>”721/45″, “controller”=>”accurev”, “virtual_version”=>”106/44″, “path”=>”/./build.xml”, “depot”=>”orbitz-api-foo”}
Accurev command (0.309664): accurev ‘cat’ ‘-p’ ‘orbitz-api-foo’ ‘-e’ ‘56′ ‘-v’ ‘106/44′
Accurev command (0.637650): accurev ‘cat’ ‘-p’ ‘orbitz-api-foo’ ‘-e’ ‘56′ ‘-v’ ‘721/45′
[snip]

Orbitz has built in a number of other optimizations and naturally this post only reveals a glance into what they’ve accomplished. But to give you an idea of the kind of volume this can support, there are anywhere from 9,000 – 10,000 requests a day for the RSS URL during the work week! Their users have given very positive feedback regarding the usefulness of this page and more enhancements are in the works, like links in from issue tracking systems.

So the next morning you come in to work, get your coffee, and fire up your Google Reader to see what’s new in the world you care about, and think about how cool it would be to automatically be able to check on all the latest code changes from your outsourced team overseas…