: Blog

Filtering Google

Published on Saturday, November 15, 2008

Oh no, another post within the same month! Horsemen spotted in the sky, flying pigs imminent!

Anyway, where was I...

Right, there's now a way to get commits from Google Code into CIA.vc that doesn't go through the hackish SVN poller. Read on for details.

SVN and hooks

As we all know, there's a new player on the block of public open-source hosting: Google Code. Apparently, as a whole bunch of people are using it, they do their stuff fair enough: SVN, wiki, bugtracking, downloads, the works.

Wait, no CIA.vc hooks? Nope. Back in the day with sourceforge and CVS, you could install your own hooks, so things worked. When sourceforge added SVN, people couldn't add their own hooks, but I gather the web config interface has a "CIA.vc hook" checkbox. But without hosting provider support, SVN users are out of luck when it comes to custom hooks.

The SVN poller

That's why we added the SVN repository poller. It wakes up a few times an hour (or whenever any mail arrives on a special address) and scans the configured repository, checking if there were any new revisions since it last looked. If there are, it enters a new commit with the right data into the system. So usually you'll set it up with the default poll delay of 15 minutes (anything below what it can make, roughly a poll every 20-30 minutes with our load, gets silently upped to that interval) or, even better, subscribe the ping email address to your commit mailing list.

That works well enough, and produces excellent XML commit data, but it's a bit hackish - the polling is horridly inefficient, and I need to run yet another service on our poor machine. Also, it's sometimes a tad slow.

Parsing E-Mail to XML

So I figured "If we already get the commit data from the mailing list, can't we use that somehow?" and resurrected an old set of scripts. What we can do now is pick up mail sent out by Google Code (via the "Activity Notifications/all subversion commits" field on the "project summary" pane of the "administration" tab) and try to parse the commit.

The results are not as fancy as the repository polling, those mails were meant for humans to read, not machines, after all. So I can't always figure out filenames, and since there's no unambiguous "end of Log message" tag I currently cut log messages at the first empty line.

But I think it's slightly faster than the polling method, and it's certainly more elegant. It's still not instantaneous, mostly because it seems Google's email machinery takes a minute or two. But if you want, use it! Simply change the mail settings (or mailing list) to send to "cia+googlecode@" instead of "ping+whatever@". (And turn off periodic polling, if you have it enabled, or you'll end up getting your commits twice)

Feedback is always welcome! (the nick I sign my posts with, at this domain; or just comment on the blog) We'll probably have a few corner cases I didn't catch, but with some work we should be able to turn this into yet another Good Way to get commits into CIA.vc!

You're with google?

Note to any google employee (especially the google code folks) reading this: I'm sure that when we work together, we can do better. Drop me an E-mail and I'll work something out. I'm a geek, so pretty much any method you come up with to pipe commits, I can handle. It's always nice to see your commit show up on IRC while your finger is still hanging over the enter key, and we should be able to make that happen.

So Far,
Karsten "BearPerson" Behrmann
#1 Chris Page wrote, on 2008-11-16:

I do hope there comes a solution for this soon enough. I have the same issue over at freepository.com where it requires an account to access however doesn't allow access to hooks to add client scripts either.

#4 Martin wrote, on 2009-03-16:

Interesting.

#11 sdfvdfbdfb wrote, on 2009-11-18:

www.flame-paint.baloven.cz.cc