September 18, 2013

A Babel Fish For Your Internal Tools

Helix Swarm
Traceability

Image: thatkaringirl w/Flickr

Over the past few years you might have noticed that we here at Perforce have been building more and more applications on top of the Perforce server; first Chronicle, then Commons, and now Swarm. However our customers have been doing this for over a decade; it turns out that a fast versioning engine that can handle millions of gianormous files is pretty handy to have at the heart of a development pipeline. Heck, some users have embedded Perforce straight into their game engine!

But there's an occasional dark side to these tools; sometimes they put information meant for machines in fields that are frequently read by people. It's far from the end of the world, but it's less than useful to get a a giant wall of JSON mixed into the rest of your changelist descriptions. If you're using Swarm you will notice these very quickly in your activity feed. Thankfully, with Swarm, we can insert a babel fish of sorts to translate this machine oriented text into something humans can make sense of.

There are two ways to deal with these bits of data we don't want to see in our activity feed; either we need to clean them up or we need to throw them out. With Swarm, we can build an activity handler which will be called any time a new activity feed entry is added. This handler can modify the entry to clean up the content before it is posted or it can stop the entry from propagating, preventing it from ever being published to users. The same type of extension is used in either case; the code just varies slightly.

We have simple examples of both stopping events and modifying events available in the Public Depot. I've also posted my code from our internal hackathon where I created a module to clean up the JSON dumps from Commons in the activity field. Taken together, the 3 examples should give you everything you need to get your machine oriented data translated for people. If you have more questions, feel free to ask in the Swarm subforum here.