A touch of coolness
George Malamidis, September 21st, 2006
Running svn info from inside your project’s Subversion working directory will produce output similar to:
Path: . URL: http://svn.rockblood.com/solo/trunk Repository UUID: 3b82abcc-450f-0410-a6ff-cb6cb9f014c2 Revision: 189 Node Kind: directory Schedule: normal Last Changed Author: george Last Changed Rev: 189 Last Changed Date: 2006-09-09 00:19:04 +0100 (Sat, 09 Sep 2006)
At a first glance, there’s nothing special about this piece of information. Look closer, though, and you’ll notice it’s actually a YAML document.
A touch of YAML.load(execute("svn info")) in Ruby, and we’re in business. Another application’s output becomes a hash, array, or object in a matter of one single line of code.
I haven’t come up with the idea, by the way, just stumbled upon it whilst going through the code of the Rails continuous_builder plugin, so respect due.
Also, I’m not so sure if the SVN guys had that in mind when they had the info command output in such a format. Does anyone know if it is intentional or just a coincidence?
The possibilities of standardizing your app’s output in such a manner are vast and I know how my app’s standard out is going to look like from now on.

September 21st, 2006 at 8:37 pm
Of course SVN’s output, like that of CVS before it, was meant from the beginning to be very structured, and therefore machine readable. I doubt it was intended to be YAML any more than HTTP headers were. But it’s a neat hack anyway.
September 21st, 2006 at 11:37 pm
Its very cool, I discovered this a while back. Here’s a little snippet I used in a project to display the current svn revision on the page footer in development mode:
http://www.bigbold.com/snippets/posts/show/2374
September 22nd, 2006 at 7:21 am
How fortuitous
I agree and I’ve been generally doing this myself for some time. Actaully I think it’s one of those things that just clicks after a while of using YAML and writing CLI tools. Recently however I started taking it a step further, expirementing with accepting YAML as command line argument:
foo –x [a,b] –y {a: 1, b: 2}
Would become:
x:
- a
- b
y:
a: 1
b :2
T.
September 23rd, 2006 at 12:09 am
Now only if svn log was also formatted as YAML…
September 24th, 2006 at 8:36 am
Alternatively, you could just use the subversion bindings for ruby to get this information via the API - rather than using an exec & parse output hack.