Beispiel #1
0
 public void CreatePullRequest()
 {
     if (this.Solution == null)
     {
         return;
     }
     if (this.WorkItem == null)
     {
         MessageBox.ErrorQuery(50, 7, "VSTS", "You must select a work item first", "Ok");
         return;
     }
     if (!EnsureHasNoChanges())
     {
         return;
     }
     WindowManager.ShowLog();
     GitService.CheckoutBranch(this.Solution, this.WorkItem.TaskID);
     GitService.Pull(this.Solution);
     GitService.Push(this.Solution);
     GitService.UpdateStatus(this.Solution, true);
     if (!EnsureHasNoChanges())
     {
         WindowManager.CloseLog();
         return;
     }
     GitService.Push(this.Solution);
     foreach (RepositoryVO repository in this.Solution.Repositories)
     {
         if ((!repository.Selected))
         {
             continue;
         }
         if (!GitService.HasCommits(repository, this.WorkItem, this.BranchBase))
         {
             continue;
         }
         bool isPullRequestAlreadyCreated  = false;
         List <PullRequestVO> pullRequests = AzureDevOpsService.ListPullRequests(repository.Path);
         foreach (PullRequestVO pullRequest in pullRequests)
         {
             if (isPullRequestAlreadyCreated = ((pullRequest.Repository == repository.Name) && (pullRequest.Title.StartsWith(this.WorkItem.TaskID))))
             {
                 break;
             }
         }
         if (isPullRequestAlreadyCreated)
         {
             continue;
         }
         //Create PR
         AzureDevOpsService.CreatePullRequest(repository, this.WorkItem);
     }
     GitService.UpdateStatus(this.Solution, true);
     WindowManager.CloseLog();
     this.RefreshUI();
 }