A few years ago I wrote a post about creating a groovy client-side script to automatically send out post-commit emails for any projects in subversion. Now about 6 years later, I find myself at a new job and have the same need again because the subversion server here is not configured to send out post-commit emails either.

Company email servers are probably under close surveillances,  I don't want to accidentally trigger any security investigations in case it sends out a large number of emails in a short period of time. Therefore this time around I thought that I should find an alternative.

Instead of sending out emails for every changeset, I decided to just create a RSS feed containing the changesets so that I can read them as if I am reading other RSS new items in a RSS reader.

I modified my script to work as followed (modifications are in bold):

1. Check out the project you want to add the hook to, then for every 5 min, execute 'svn log -r BASE:HEAD' on that project to get a list of revisions and logs.

2.Parse these logs to get a set of revision numbers (and the author, date, etc). Then for each revision, execute 'svn diff -r $rev1:$rev2' for each adjacent revisions. For example, if the revisions were r182, r183, and r184, then the script needs to to a diff for r182:r183 and r183:r184. Create a RSS feed file, for each diff, add the diff as an entry in the feed.

3. After all the diffs are performed, execute 'svn up -r $lastrev' to bring your local copy to the latest revision that you had checked against (note: do not update it to HEAD because there might be commits during the time when the script is processing).

The generated RSS feed can then be loaded into a RSS feed reader/aggregator so that I can read them whenever I feel like reading the subversion activities. Most RSS feed readers won't read local files but I found one that will. It's called QuiteRSS . It also has all the functionalities that I need, including auto refresh, feed items aggregation and feed items management (mark item as read, delete item, etc).

To add a local RSS feed file to QuiteRSS, you need to add it using file: url scheme, i.e. "file:///C:\Users\abcuser\Desktop\geoGoogle_rss.xml"

With all of these things setup, I can again read every change made to a project of interest just like having post-commit emails. Here's what it looks like when the generated feed is loaded in QuiteRSS, it works just like getting the diffs in email.



Here's the full script for your viewing pleasure:

A few additional notes about this groovy script:

1. The script generates a {Project_Name}_rss.xml file in the same folder of the script.
2. The RSS feed format is a strip down version of RSS 2.0 format, this format seems to work well with QuiteRSS but it has not been tested with other RSS feed readers. Most RSS feed readers should be forgiving enough to be able to process the generated feed.

3. In the rare occasions that someone check in a large text files, the script can run out of memory processing large text checkins.