Migrating from Visual Source Safe to Subversion (VSS to SVN)

This is an improved version of the Perl migration script (migrate.pl) found at "Visual SourceSafe to Subversion Migration" by Brett Wooldridge.

I have added the following features:

  1. Group VSS file check-ins by user, time and comment into atomic commits into Subversion. It is reasonable that all files checked in by the same user, at the same time, and with the same comment, are part of the same fix and should be checked in at the same time in the Subversion repository.
  2. Handle directory names and file names that contain spaces.
  3. Handle line breaks and special characters in comments.
  4. Allow running the script multiple times to migrate check-ins done after the previous migration.
  5. Note that I have changed the command line arguments a little, and changed the meaning of some of them slightly. In particular, --repos is the URL of an existing directory in the Subversion repository into which the contents of the VSS project (project argument) should be migrated. --restart has been renamed --resume, and I have added --migrate-latest.
  6. Also note that because I live in Sweden, I use a locale that displays dates as "2006-12-22" and times as "15:29:48". I have therefore modified the script to parse this date and time format from the VSS file histories. (See line 437 in the script.)
  7. The commit time for each commit is set to the original VSS check-in time. For this to work you must create the pre-revprop-change hook in the SVN repository and in it allow setting the svn:date revision property.

Here is the runtime help:

C:\temp\new-migrate>perl migrate.pl --help
Usage: migrate [options] project
Migrate a Visual SourceSafe project to Subversion.
--resume              resume the migration from last checkpoint
--migrate-latest      refresh history and atoms, and resume after last checkpoint
--ssrepo=<dir>        repository path, e.g. \\share\vss
--sshome=<dir>        VSS installation directory
--repos=<url>         URL for the Subversion repository
--force-user=<user>   force the files to be checked into Subversion as
as user <user>
--dumpusers           after pre-processing the VSS repository, create a
users.txt file which can be used to create comparable
accounts in Subversion.  The migration can be resumed
without penalty by using the --resume option

I run migrate.pl from a Command Prompt using ActiveState's perl.

AttachmentSize
migrate.pl_.txt33.43 KB

Comments

Further development

Neil Sleightholm has been improving on this script after me. His new version (3.xx) can be found at http://neilsleightholm.blogspot.com/2007/08/migrating-from-visual-source-safe-to.html.

Bug fixes

Thanks to Ethan Hall-Beyer, a few bugs have been found and fixed:

  1. Handling of '(' and ')' in VSS project names.
  2. I had used the $count variable for two differerent things when setting the commit time.

Problem with $*

The original script used $*, which is no longer supported in perl.

What it does is change how newlines are treated in regular expressions. Much like /m and /s in REGEX.

I just added the /m option to every REGEX between every point that $* was set to 1 until $* is set to 0.

For more info, see http://stackoverflow.com/questions/1782015/what-did-perls-variable-use-to-do