public void CheckoutBranchGit() { if (this.Solution == null) { return; } GitService.UpdateStatus(this.Solution, true); if (!EnsureHasNoChanges()) { return; } string defaultValue = string.Empty; if (this.WorkItem != null) { defaultValue = this.WorkItem.TaskID; } string branch = WindowManager.ShowDialogText("Choose the branch", "Branch:", defaultValue); if (string.IsNullOrEmpty(branch)) { return; } WindowManager.ShowLog(); GitService.CheckoutBranch(this.Solution, branch); GitService.UpdateStatus(this.Solution, true); WindowManager.CloseLog(); this.RefreshUI(); }
public void SyncBranch() { 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.UpdateStatus(this.Solution, true); GitService.CheckoutBranch(this.Solution, this.BranchBase); GitService.Pull(this.Solution); GitService.UpdateStatus(this.Solution, true); GitService.CheckoutBranch(this.Solution, this.WorkItem.TaskID); GitService.MergeBranch(this.Solution, this.BranchBase); GitService.UpdateStatus(this.Solution, true); WindowManager.CloseLog(); this.RefreshUI(); }
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(); }
public void ShowBranchs(string repositoryName) { RepositoryVO repository = this.Solution.GetRepositoryByName(repositoryName); List <string> branchs = GitService.ListBranchs(repository); string branch = WindowManager.ShowDialogList("Branchs", branchs); if (string.IsNullOrEmpty(branch)) { return; } GitService.UpdateStatus(this.Solution, true); if (!EnsureHasNoChanges()) { return; } GitService.CheckoutBranch(this.Solution, branch); GitService.UpdateStatus(this.Solution, true); this.RefreshUI(); }
internal void CheckoutBranch() { GitService.CheckoutBranch(CurrentGitPath, SelectedBranch); CurrentBranch = GitService.GetCurrentBranchName(CurrentGitPath); Commits = new ObservableCollection <Commit>(GitService.GetCommits(CurrentGitPath)); }