Converting from TFS to Mercurial

During the weekend, I wrote a quick and dirty program to convert a TFS project to a Mercurial repository: Tfs2Hg. It gets all changesets from TFS, and commits them to the Mercurial repository, one by one, including date and comments.

The program can be used to convert from scratch, but also to upgrade an existing repository to the latest TFS changeset: It stores the last downloaded changeset number in the file .lastTfsChangeSet

Feel free to improve on the source code, for instance by writing a couple of tests… (Yes, I know I should have written those first… :-) However, it has been tested with a TFS project containing more than 7,000 changesets…)

Edit: The tool requires Microsoft.TeamFoundation.Client.dll and Microsoft.TeamFoundation.VersionControl.Client.dll, but if you have VS 2010, they are already installed. In addition, it of course requires Mercurial…

Good luck!

Leave a Reply