How to Prevent Data Loss in the Subversion Cleanup Cycle


Subversion is an open source version control system. It uses local directories and files as metadata in order to keep track of synchronizing your local copy of a project with the copy that is on the Subversion server. Sometimes these local files get “hosed” (that’s a technical term meaning really messed up). This is usually because there was a connection issue that occurred during the time that you were performing an SVN action with the server.

In such cases, the software will inform you that something went wrong and that you need to perform the Cleanup action. And in some cases, this Cleanup action also fails, leaving you with a project that can no longer commit code changes back to the server. What to do?

I come from the old school of programming. Not the old school that reminisces about the stack of punch cards, but the generation after that. This solution comes from that old school mentality. It is simple. And, most importantly, it works!

The Solution

  1. Check out your project code to an alternate location.
  2. Perform a diff (compare) between the directory that is hosed and the new directory.
  3. Copy/merge your changes to the new directory.
  4. Commit your changes!

Wait… that’s it! Yes, that’s the beauty of this solution. It is really simple! You can perform an internet search and find several really good articles on how to cleanup your project so as to be able to commit your changes. However, they are not for the faint of heart and are error prone.

In order to perform the diff and merge your changes into your fresh copy of the project, you’ll need a tool that can diff entire directories. I usually work within a Windows environment, so my tool of choice is WinMerge.

Remember, the best solutions aren’t always the most complex. Sometimes, even in software engineering, the KISS principle is best.