private static void MigrateRepository(Options options) { var workspaces = new[] { new Func <GitWorkspace>(() => new GitWorkspace(new DirectoryInfo(options.RepositoryDirectory), options.TfsBranchPath)) }; var teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(options.TeamProjectCollectionUri)); var settings = new MigrationSettings { ContinueOnError = options.ContinueOnError, }; RepositoryMigrator.Migrate(teamProjectCollection, workspaces, settings); }
public static void Migrate(TfsTeamProjectCollection teamProjectCollection, IEnumerable <Func <GitWorkspace> > workspaces, MigrationSettings settings) { foreach (var workspaceFactory in workspaces) { var workspace = workspaceFactory(); try { Console.WriteLine(teamProjectCollection.Uri); Console.WriteLine($"{ workspace.ServerHomePath} => {workspace.RepositoryHome}"); Console.WriteLine("-------------------------------------"); Migrate(teamProjectCollection, workspace); workspace.Tag($"migration/{DateTime.UtcNow.ToString("yyyyMMddTHHmmss")}z", new Signature("Build Management", "*****@*****.**", DateTimeOffset.Now), $"{teamProjectCollection.Uri}\n{workspace.ServerHomePath} => {workspace.RepositoryHome}"); Console.WriteLine($"COMPLETED {workspace.RepositoryHome}"); } catch (Exception ex) { Console.WriteLine($"ERROR migrating {workspace.RepositoryHome}"); Console.WriteLine(ex.Message); if (!settings.ContinueOnError) { throw; } } } }