コード例 #1
0
ファイル: Lazy.cs プロジェクト: silvath/lazy
        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();
        }
コード例 #2
0
ファイル: Lazy.cs プロジェクト: silvath/lazy
 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();
 }
コード例 #3
0
ファイル: Lazy.cs プロジェクト: silvath/lazy
 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();
 }
コード例 #4
0
ファイル: Lazy.cs プロジェクト: silvath/lazy
        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();
        }
コード例 #5
0
 internal void CheckoutBranch()
 {
     GitService.CheckoutBranch(CurrentGitPath, SelectedBranch);
     CurrentBranch = GitService.GetCurrentBranchName(CurrentGitPath);
     Commits       = new ObservableCollection <Commit>(GitService.GetCommits(CurrentGitPath));
 }