Edmund's blog

Writing code.

Migrate SourceSafe to Mercurial

If you are still using SourceSafe today then you should move away from it as soon as possible. SourceSafe is buggy, slow, and tends to corrupt its database. Microsoft stopped supporting it years ago. Mercurial is nice and friendly. It works well on Windows, and is open source.

With vss2hg you can convert a SourceSafe project to a Mercurial repository. The perl script was written by Andy Duplain. I made a bunch of small fixes to it. You can download it here.

I used the vss2hg script to convert a bunch of SourceSafe projects with more than ten years of history. The largest took 24 hours to convert. It is slow, but it works.

After you have installed ActivePerl, you can run it from the command line.

1
2
3
set ssuser=MyName
set sspwd=MyPassword
vss2hg.pl --ssrepo="\\MyServer\VSS" --sshome="C:\Program Files (x86)\Microsoft Visual SourceSafe" $/MyProject

You need to set the OS to the US date format, otherwise the script does not work.

It is possible to make updates after the initial conversion by using the command line options --migrate-latest and --resume. This works pretty well when no files have been deleted or renamed in SourceSafe. Otherwise you can manually edit the histories.txt file, and then re-run --resume. I use kdiff3 to check that there are only changes at the bottom.

1
2
3
vss2hg.pl --ssrepo="\\MyServer\VSS" --sshome="C:\Program Files (x86)\Microsoft Visual SourceSafe" --migrate-latest $/MyProject
kdiff3 atoms.txt.1 atoms.txt
vss2hg.pl --ssrepo="\\MyServer\VSS" --sshome="C:\Program Files (x86)\Microsoft Visual SourceSafe" --resume $/MyProject