Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / XSLT

Subversion RSS Logs

4.69/5 (7 votes)
19 Jun 2008CPOL4 min read 1   116  
An application to interact with a Subversion repository and produce logs in a few different formats; TXT, XML, XML with XSL, and RSS.

Introduction

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.

Background

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:

  • repository_location
  • last_revision
    • 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.
  • output_type
    • Console
      • Outputs all data to the console.
    • RSS
      • A standard RSS feed. The feed is set to maintain the past days worth of data.
    • TXT
      • A flat text file containing the data. If the file exists, it will append the new data to the end.
    • XML
      • An XML file containing the raw data. If the file exists, it will append the new data to the end.
    • XLMTransform
      • A transformation of the raw XML data.
      • Not fully tested and implemented. This is currently a work in progress.
  • service_interval
    • 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 –removeservice argument.

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.

History

  • 19th June, 2008: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)