private static void Migrate(TfsTeamProjectCollection teamProjectCollection, GitWorkspace workspace) { teamProjectCollection.EnsureAuthenticated(); var versionControlServer = teamProjectCollection.GetService <VersionControlServer>(); var history = (from changeset in versionControlServer.QueryHistory(workspace.ServerHomePath, RecursionType.Full) select versionControlServer.GetChangeset(changeset.ChangesetId)) .OrderBy(changeset => changeset.ChangesetId); using (var tfsWorkspace = new TfsWorkspace(teamProjectCollection.Uri, workspace.ServerHomePath)) { ProcessChangesets(teamProjectCollection, workspace, tfsWorkspace, history); } }
private static void ProcessChangesets(TfsTeamProjectCollection teamProjectCollection, GitWorkspace workspace, TfsWorkspace tfsWorkspace, IOrderedEnumerable <Changeset> history) { foreach (Changeset changeset in history) { Console.WriteLine("Log Time: " + DateTimeOffset.Now.ToString()); Console.WriteLine("Changeset Id: " + changeset.ChangesetId); Console.WriteLine("Owner: " + changeset.Owner); Console.WriteLine("Date: " + changeset.CreationDate.ToString()); Console.WriteLine("Comment: " + changeset.Comment); tfsWorkspace.GetSpecificVersion(changeset.ChangesetId); Command.ExecuteRobocopyCommand($@"/MIR ""{tfsWorkspace.LocalFolder.FullName}"" ""{workspace.RepositoryHome.FullName}"" /XD "".git"" ""$tf"" ""packages"""); var author = CreateSignature(teamProjectCollection, changeset.Committer, changeset.CommitterDisplayName, changeset.CreationDate); workspace.Commit(changeset.Comment, author, author); } }