Work around now commercial features of OpsHub VSO Migration Utility

OpsHub has a relatively simple tool to help you migrate your work items and version control data from an on-premise TFS server to Visual Studio Team Services. They recently released version 2.0, which brings a number of improvements.

Unfortunately this new version has also removed some of the features which were previously free and moved them to an intermediate commercial version between the Free and the full fledged OpsHub Integration Manager.

Here's the full feature comparison between the free and the commercial version:

There are a few deal breakers in here for me, item 21, the migration of the actual user who made the change used to be part of the free version, the partial user impersonation is new. The free version no longer shows adds any information about the original check-in. Nothing. Instead of seeing:

Checked in by: VSO-MIGRATION USER

My checkin comment

originally checked in by: tfs\user, on: 2014-10-09 14:12:00 GMT

You now just get:

Checked in by: VSO-MIGRATION USER

My checkin comment

It's a bit strange to me that they're still asking me to perform the user mapping step, they're totally ignoring that data when you do a Version Control only migration.

While there are other features of the commercial version which are nice, especially when migrating work items, on the version control side of things, this is a total deal-breaker for the free version for me. Unfortunately, OpsHub quoted me $5000 + $1750 per team project to unlock the commercial features, for my client, given that they've created a lot of projects they want to keep, this would come close to $20.000.

Luckily, the check-in comment is mutable on the server side, so instead of having OpsHub change the comment at the time of check-in, you can actually change all the changesets and update them with this information pre-conversion. If you need to, you can remove them afterwards as well with a clever regex.


using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
namespace TfsChangesetCommentEnricher
{
    class Program
    {
        static void Main(string[] args)
        {
            var collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(
                new Uri("http://jessehouwing:8080/tfs/defaultcollection"));
            var vcs = collection.GetService<VersionControlServer>();
            var changes = vcs.QueryHistory(new ItemSpec("$/", RecursionType.Full));
            foreach (var change in changes)
            {
                if (!change.Comment?.Contains("\r\n\r\n-- \r\nOriginally checked-in") ?? true)
                {
                    change.Comment = string.Format(
                        CultureInfo.InvariantCulture,
@"{0}
-- 
Originally checked-in
* by: {1} ({2})
* on: {3:u}
* in: {5}
* id: {4}",
                        change.Comment,
                        change.Committer,
                        change.CommitterDisplayName,
                        change.CreationDate,
                        change.ChangesetId,
                        change.VersionControlServer.TeamProjectCollection.Uri);
                        change.Update();
                }
            }
        }
    }
}

Which just saved my client $20.000.

With this information available in the comments, converting labels would also be possible. Luckily my client isn't using those much.