void PerformRepoSync(Syncer som, string repoName, string defaultBranch, string srcRoot, string solutionName, List<SyncItem> itemsToSync) { if (itemsToSync == null) { itemsToSync = DefaultTemplateRepo.ItemsToSync; } if (solutionName == null) { solutionName = repoName; } var toSync = new RepoToSync { Name = repoName, Branch = defaultBranch, SolutionName = solutionName, SrcRoot = srcRoot }; var diff = som.Diff(toSync.GetMapper(itemsToSync)); Assert.NotNull(diff); var createdSyncBranch = som.Sync(diff, SyncOutput.CreatePullRequest, new[] { "Internal refactoring" }).FirstOrDefault(); if (string.IsNullOrEmpty(createdSyncBranch)) { Console.Out.WriteLine("Repo {0} is in sync", repoName); } else { Console.Out.WriteLine("Pull created for {0}, click here to review and pull: {1}", repoName, createdSyncBranch); } }
public void Sync() { using (var syncer = new Syncer(GetCredentials(),null, ConsoleLogger)) { foreach (var map in Mapper()) { var diff = syncer.Diff(map); foreach (var output in syncer.Sync(diff, SyncOutput.CreatePullRequest)) { if (!string.IsNullOrEmpty(output)) { Console.Out.WriteLine("Done " + output); } } } } }