This post originated from an RSS feed registered with Python Buzz
by Phillip Pearson.
Original Post: [Minimal] pure PHP Subversion client
Feed Title: Second p0st
Feed URL: http://www.myelin.co.nz/post/rss.xml
Feed Description: Tech notes and web hackery from the guy that brought you bzero, Python Community Server, the Blogging Ecosystem and the Internet Topic Exchange
Something interesting I did back in 2006 was write a pure PHP parser for the Subversion REPORT XML format, which is what a Subversion server sends in response to a checkout or update request. The code could check out a fresh copy of a repository, and also handle the XML well enough to update from revision to revision. I did this to implement the auto-update process for PeopleAggregator, for Broadband Mechanics.
It's worked pretty well, and I'm pretty proud of the code... not its beauty, because it's fairly inscrutable, but in that it worked at all, and that it was as reliable as it was. I think it took a few days to write, and after a couple of minor bugs found over the next week or two, we didn't find anything wrong with it until much later, when we shipped an update which deleted a file, which was a case I hadn't considered when writing it. After fixing that it worked just fine from then on.
Anyway, Marc gave me permission to release this as open source under the MIT license (like CC-BY: fairly unrestricted use, with attribution) a year or two back, and people have asked me about it from time to time, but I've never actually put up an official copy with the MIT license on it. So, here you go:
I never spent the time to properly extricate it from PeopleAggregator, so you'll need to hack PAStateStore.php into something that fits your own database, and figure out the schema. If someone wants to write a pure-PHP handler for .svn directories, or even a generic state store which stores hashes like PAStateStore (but maybe in a flat file rather than a database), that would be brilliant. Fork and enjoy!