async Task <IPullRequestModel> PushAndCreatePR(IRepositoryHost host, ILocalRepositoryModel sourceRepository, IRepositoryModel targetRepository, IBranch sourceBranch, IBranch targetBranch, string title, string body) { var repo = await Task.Run(() => gitService.GetRepository(sourceRepository.LocalPath)); var remote = await gitClient.GetHttpRemote(repo, "origin"); await gitClient.Push(repo, sourceBranch.Name, remote.Name); if (!repo.Branches[sourceBranch.Name].IsTracking) { await gitClient.SetTrackingBranch(repo, sourceBranch.Name, remote.Name); } // delay things a bit to avoid a race between pushing a new branch and creating a PR on it if (!Splat.ModeDetector.Current.InUnitTestRunner().GetValueOrDefault()) { await Task.Delay(TimeSpan.FromSeconds(5)); } var ret = await host.ModelService.CreatePullRequest(sourceRepository, targetRepository, sourceBranch, targetBranch, title, body); usageTracker.IncrementUpstreamPullRequestCount(); return(ret); }
public Task IncrementUpstreamPullRequestCount() => inner.IncrementUpstreamPullRequestCount();