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

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

  • Minimise to tray
  • When the application is not in use it is only shown in the system tray, not the taskbar.

  • Scan every
  • The interval in which to scan each SVN repository for changes.

  • Time out
  • The amount of time to wait for remote operations to complete before giving up.

  • Run on startup
  • When checked, the program will start running as soon as the user logs into Windows.

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.

  1. Mihir’s avatar

    On Vista Ultimate 32Bit

    1) Installed properly.
    2) Asked me to install SVN (I prefer TortoiseSVN)
    3) After installing SVN, it launches properly.
    4) After adding a source, it scanned it and found 54 new entries.

    Nice work! :)

  2. jimblackler’s avatar

    Thanks Mihir I appreciate the testing. Unfortunately the official SVN client is a necessity because I couldn’t get the official API to play ball with the log fetching.

  3. Matt Sidesinger’s avatar

    Jim, I am having trouble locating the “Windows Subversion client.” Above it sounds like Tortoise SVN is not the correct client. Is RapidSVN the “official SVN client?”

  4. jimblackler’s avatar

    Hi Matt, I mean the basic command line ‘svn’ tool built for Windows.

    Normally it is here http://www.collab.net/downloads/subversion/ but at the time of writing that link is not working.

  5. Matt Sidesinger’s avatar

    I installed this client, SlikSVN, which I believe is the official Tigris SVN client: http://www.sliksvn.com/en/download

  6. Per Fagrell’s avatar

    Hi!
    This is a great app, but has some stability issues on vista enterprise. It can’t remember which repositories it should watch over a restart, and yesterday it failed to find check-ins despite there having been several. That last one might be a silent svn-failure I guess. We’re a team of about 60 that would be really interested in running svnwatch if these issues were sorted! Keep up the good work!

  7. jimblackler’s avatar

    Thanks Per. Nice to get feedback. I haven’t run it on Vista ever myself, I wonder what the best way would be to attempt to recreate your scenario?

  8. Per Fagrell’s avatar

    Well, now it’s remembering it’s repository and finding everything, but dying on startup (windows startup that is, works just fine after windows has come up). We’re not running anything peculiar, vista on a domain with eclipse and subversion over ssl.

  9. Noam Bunder’s avatar

    Any way to add authentication credentials for Subversion repositories that require them?

  10. Dean Ashton’s avatar

    Hi,

    Saw this app yesterday, and gave it a spin on some of our local SVN repositories (under Vista x64), and had some issues. The version of SVN.EXE that I run here is 1.6.2 r37639, which seems to have an additional (and unhandled) ‘kind’ type, as in this example entry:

    /project/trunk/CMakeLists.txt

    I just added “” to the XSD, and rebuilt.. and now everything seems ok.

    Cheers!
    Dean

  11. Dean Ashton’s avatar

    Oh.. I should have realised that XML comments would probably screw the posting up! :)

    Anyway, I just added an XML string attribute called ‘kind’ to the ‘pathType’ entry.

  12. Swapnil’s avatar

    Hi Jim,
    I have installed SVN Watch along with Slik SVN as Tortoise SVN doesn’t have SVN.exe and it’s not detecting the one I have from Visual SVN and even if it is defined in path variable as I can execute svn command from dos prompt.
    Anyways once I managed to launch SVN Watch and adding the repositories I am getting credential errors………..even if I added the windows user into the svn userlist and set the same password as that of windows, still I am getting following error:
    Problem reading repository: The ‘kind’ attribute is not declared.

    Any help is appreciated.

    Thanks in Advance,
    Regards,
    Swapnil

  13. Frank’s avatar

    I have the same problem: at SVNWatch.SVNWatch.visualBackgroundWorker1_DoWork(Object sender, DoWorkEventArgs e)
    at MiscControls.VisualBackgroundWorker.backgroundWorker1_DoWork(Object sender, DoWorkEventArgs e)
    at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
    at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
    There are some solution to this Issue?
    Thx.
    Frank.

  14. naxa’s avatar

    For those whoe have problems end error messages like
    “Problem reading repository: The ‘kind’ attribute is not declared.”
    Based on a previous comment kindly provided by Dean Ashton, I managed to solve this for myself.
    What needs to be done is:

    You have to rebuild SVNWatch with a minor modification.
    I have done it and uploaded it, so you can download, but I can take no responsibility for it and strongly adwise to rebuild it manually.

    Steps to do for rebuilding manually:
    1) get the source code of SVNWatch (with svn)
    2) get Visual Studio (C#, freely available from microsoft)
    3) open to edit SVNWatch/svnlog.xsd with a text editor such as notepad
    4) search for the line xs:complexType name=”pathType”
    5) below this line, there are several lines beginning with “xs:attribute” …
    6) add another line just like this in the same section, with name=”kind” and type=”xs:string”, so like this:
    xs:attribute name=”kind” type=”xs:string”
    (but with the opening and closing symbols).
    7) save the file
    8) open SVNWatch/SVNWatch.sln in visual studio
    9) go to Build menu and click build
    10) the new svnwatch is the bin\debug directory

    optionally you can go to the build menu and configure… the build, and instead of “Debug” profile, select the “Release” profile. then click build. it would be the proper method. The new svnwatch would be in bin/release folder.

    My updated svnlog.xsd is available here:
    http://www.mediafire.com/?yl9bs51xapwwy64

    If you prefer, you could try my version of SVNWatch. The described mod is the only modification in it. Binaries available here:
    http://www.mediafire.com/?63klb842395734f

  15. Amit’s avatar

    A very helpful app. Keep up the good work !

  16. Brian’s avatar

    I am trying to checkout your source code to insert the xsd code and rebuild however I am getting problems with the checkout.

    This is the command that I’m trying to execute:
    “svn checkout http://svn.jimblackler.net/jimblackler/trunk/Visual%20Studio%202005/Projects/

    Either I’m doing something silly or there is a problem with the repository. Local SVN checkouts work on my machine.

  17. jimblackler’s avatar

    Brian, that should work. Not sure what’s going wrong to be honest.

  18. jimblackler’s avatar

    No .. yes I do.. you won’t have an account. Let me add one for you, I’ll mail you the credentials.

  19. cayonara’s avatar

    This is totally awesome, thanks for saving me tons of time :))

Reply

Your email address will not be published. Required fields are marked *