Every developer, whether working alone or within a group, should use a form of source control. It is an essential part of effective programming and collaboration. A popular source control system is Subversion. I have been developing with source control systems for a few years. I have found that there are some things they all do great; but there are usually a few things they all do not do so great. In my time, one thing that I have found that they usually don't do so great at is communication. It is important to know if another developer has made a change to a region of code that could impact what you are working on. There are also other key players that are not developers that need to be kept in the know. While there is no substitution to direct communications, a solution to this that I have found is using RSS feeds to keep everyone updated.
While there are many different ways to get Subversion to produce an RSS feed, most of them involve using having direct access to the Subversion server and using hook scripts. This may not be possible in all situations. My solution does not use any hook scripts or require code to be running on the Subversion server. My solution utilizes the ability to retrieve the logs from the Subversion client. I recently came across SharpSvn, a binding of the Subversion Client API for .NET 2.0 applications. I use the SharpSvn API to interact with a Subversion repository to retrieve the list of changes and report them back as an RSS feed that can be consumed by end users.
To generate the RSS feed, I have included a custom component that I have written, myRSS. It is pretty easy to create a RSS feed with it and I have been using it for quite some time. Built into it is the ability to write RSS feeds and read RSS feeds. The output can be to either a stream or to a file. I have been using the stream output in an ASP.NET project to write to the Response stream. It has worked very well so far. I also have built an RSS reader using myRSS as the engine. Both projects have been used in production environments for quite some time without issue. If there is interest, I will post an article about it.
Using the Code
The configuration of the application is pretty simple. The settings are stored in an Application Configuration file. The settings are as follows:
- The location of the Subversion repository. It can take any valid URI format that Subversion will accept.
- It can also include a specific directory of the repository
- The revision of the Subversion repository that the next run of the application will retrieve data for. This gets updated to the last revision every time the application runs and finds changes.
- Outputs all data to the console.
- A standard RSS feed. The feed is set to maintain the past days worth of data.
- A flat text file containing the data. If the file exists, it will append the new data to the end.
- An XML file containing the raw data. If the file exists, it will append the new data to the end.
- A transformation of the raw XML data.
- Not fully tested and implemented. This is currently a work in progress.
- When the application is running in Service Mode, this controls the interval (in minutes) the service retrieves the logs.
The application can run as either a console application or as a Windows service. I came up with the idea from this Code Project article. To run it as a console application, run the application without any arguments. To run the application as a service, run it with a
–service argument. To remove the service from the system, run the application with a
To install, extract the compiled binaries and the application configuration file to a directory. Set up the application configuration file as needed. Install the application as a service (run once with a
–service argument) or setup a Task Scheduler task to execute the application without any arguments. Setup a Virtual Directory with IIS to point to the directory where you extracted the files and installed the service.
Points of Interest
None really yet. Comments and criticisms are welcome.
- 19th June, 2008: Initial post