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.
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(“https://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(“rnrn– rnOriginally 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.