Windows desktop alerts for remote Subversion repositories. A .NET 2.0 application in C#

Posted by jimblackler on Mar 27, 2008

An SVNWatch desktop alert

Part of my last job involved some management of a large code base. I wanted to keep an eye on activity on the Subversion source control database. In particular I wanted to know as soon as someone had checked in and what the changes were.

There are many plug-ins available for Subversion (also known as SVN) that will email interested parties when the repository changes, but my experience with these is that they create so many emails that people end up turning them off. Also, they need administrator access to the database which not everyone will have.

I hit on the idea for a “notifier” application for Subversion that would act like the gmail notifier, letting interested parties know as soon as an SVN database is changed. The Windows balloon alerts are ideal for this sort of thing, so I wrote an application for Windows Forms .NET 2.0 which I am ready to publish today.

SVNWatch

SVNWatch is a Windows application that provides desktop alerts when nominated SVN repositories are changed.

The application runs in the status bar. Alerts when the repositories change take the form of messages in status bar ‘balloons’, and a change in the appearance of the status bar icon.

Clicking on the status bar icon will display a list of the new SVN log entries since the last scan operation.

The application can watch an unlimited number of SVN repositories.

Prerequisites

SVNWatch requires two other components to be present on the user’s PC:

  1. The .NET Framework version 2. Vista comes with this pre-installed. For XP, this can be downloaded from the Microsoft website here.
  2. The Subversion Windows client software (“SVN.EXE”). This can be downloaded from the Tigris/Subversion website here.

    This is required because SVNWatch invokes the SVN.EXE to interface with the repositories, rather than using an internal static library. I had poor results getting the same results out of the standard API that are available through the SVN.EXE route.

The main dialog

The main dialog lists the watched repositories, provides options to manage the list and gives information about forthcoming scans.

The main SVNWatch window

Click on the ‘Add Repository’ toolbar button or from the Repository menu select Add.

A New Repository dialog will be shown. Under Monitor Url enter the URL of the repository, for instance http://svn.jimblackler.net/jimblackler/trunk.

Click OK to add and start monitoring the repository.

First time connection

SVNWatch will fetch and display the first batch of logs. If there is a technical problem connecting to the repository or fetching the logs, this will be displayed in the bottom of the main SVNWatch dialog.

Regular scans

As long as SVNWatch is running, it will regularly scan repositories for new logs
to report. The frequency of scans can be changed in the Settings.

When new logs are available a notification balloon will be shown in the task bar. If just one new log is seen, a quick summary of the check in comments will be shown. If more than one log is available, the number of logs available will be shown.

An alert just displaying the number of logs received

Clicking on the bubble will show a full and detailed list.

A full list of new logs

In addition, the task tray icon will change to indicate there are new logs that have not been viewed by the user.

If new logs are available, they can also be viewed by clicking on the View New Logs button.

Edit repository settings

Repository URLs or other settings can be edited at any time by selecting the repository in the main list and selecting Edit Repository.

The user can also view when the last scan was performed and what the outcome was. This can be useful for troubleshooting problems to do with database connection.

The Maximum Fetch value indicates the largest number of logs to download. This is necessary because some long-established SVN repositories are very large.

Settings

Settings, which include the repositories scanned, are automatically saved and retrieved. They are stored for each Windows user.

The settings file can be found in a location such as C:\Documents and Settings\User Name\Application Data\SVNWatch\settings.bin where User Name is the current logged in Windows user name.

The settings can be edited by selecting the Edit menu then the Settings menu item.

The settings dialog

Download

Download SVNWatch as an executable installer from here. Before running SVNWatch, go to the Tigris official Subversion website and download and install the Windows Subversion client (used by SVNWatch).

Alternatively, you may obtain the source code from my own SVN repository here. The project can be built with Visual Studio 2005 C# Express or other later versions of Visual Studio. SVNWatch and its dependent projects are open source, licensed under the LGPL.


Obtaining inline XML C# documentation at runtime using .NET 2.0

Posted by jimblackler on Mar 23, 2008