Exemple #1
0
 public static void CreateBranch(SolutionVO solution, WorkItemVO workItem, bool onlySelected = true)
 {
     foreach (RepositoryVO repository in solution.Repositories)
     {
         if ((!onlySelected) || (repository.Selected))
         {
             CreateBranch(repository, workItem);
         }
     }
 }
Exemple #2
0
        private CheckBox CreateCheckbox(int x, int y, SolutionVO solution, WorkItemVO workitem)
        {
            string name = solution.Name;

            if (workitem != null)
            {
                name = name + string.Format(" (WIT - {0} - {1} )", workitem.Code, workitem.Name);
            }
            CheckBoxSolution checkbox = new CheckBoxSolution(this, x, y++, name, solution.Selected);

            checkbox.Toggled += Checkbox_Solution_Toggled;
            return(checkbox);
        }
Exemple #3
0
        public static bool HasCommits(RepositoryVO repository, WorkItemVO workItem, string branchBase)
        {
            string response = ProcessService.Execute("git", string.Format("cherry {0} {1}", branchBase, workItem.TaskID), repository.Path);

            string[] lines = response.Split("\r\n");
            foreach (string line in lines)
            {
                if (!string.IsNullOrEmpty(line.Trim()))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #4
0
        public static void CreateBranch(RepositoryVO repository, WorkItemVO workItem)
        {
            string branch = workItem.TaskID;

            if (repository.Branch == branch)
            {
                return;
            }
            List <string> branchs = ListBranchs(repository);

            if (branchs.Contains(branch))
            {
                CheckoutBranch(repository, branch);
                return;
            }
            ProcessService.Execute("git", string.Format(@"checkout -b {0}", branch), repository.Path);
            ProcessService.Execute("git", string.Format(@"push --set-upstream origin {0}", branch), repository.Path);
        }
Exemple #5
0
        private static WorkItemVO CreateWorkItem(string line)
        {
            if (string.IsNullOrEmpty(line))
            {
                return(null);
            }
            int index = line.IndexOf(" ");

            if (index < 0)
            {
                return(null);
            }
            if (!Int32.TryParse(line.Substring(0, index), out int id))
            {
                return(null);
            }
            WorkItemVO workItem = new WorkItemVO();

            workItem.Code = id;
            workItem.Name = line.Substring(index + 1).Trim();
            return(workItem);
        }
Exemple #6
0
        public static List <WorkItemVO> ListWorkItems(string workingDirectory)
        {
            List <WorkItemVO> workItems = new List <WorkItemVO>();

            if (!IsConfigurated())
            {
                return(null);
            }
            string command   = _vstsPath;
            string arguments = @"work item query --wiql ""SELECT System.ID, System.Title FROM workitems WHERE[System.AssignedTo] = @Me AND[System.State] = 'In Progress' ORDER BY System.ID DESC""";
            string response  = ProcessService.Execute(command, arguments, workingDirectory);

            string[] lines = response.Split("\r\n");
            foreach (string line in lines)
            {
                WorkItemVO workItem = CreateWorkItem(line.Trim());
                if (workItem != null)
                {
                    workItems.Add(workItem);
                }
            }
            return(workItems);
        }
Exemple #7
0
        public void ShowWorkItems()
        {
            if (this.Solution == null)
            {
                return;
            }
            if (!AzureDevOpsService.IsConfigurated())
            {
                MessageBox.ErrorQuery(50, 7, "VSTS", "You must configure VSTS client first", "Ok");
                return;
            }
            string            path                  = Directory.GetParent(this.Solution.Path).FullName;
            List <WorkItemVO> workItems             = AzureDevOpsService.ListWorkItems(path);
            Dictionary <WorkItemVO, string> objects = new Dictionary <WorkItemVO, string>();

            foreach (WorkItemVO workItem in workItems)
            {
                objects.Add(workItem, string.Format("{0} - {1}", workItem.Code, workItem.Name));
            }
            WorkItemVO workitemSelected = WindowManager.ShowDialogObjects <WorkItemVO>("WorkItems", objects);

            this.WorkItem = workitemSelected;
            this.RefreshUI();
        }
Exemple #8
0
 public static void CreatePullRequest(RepositoryVO repository, WorkItemVO workItem)
 {
     string command   = _vstsPath;
     string arguments = string.Format(@"code pr create --title ""{0} {1}"" --work-items {2}", workItem.TaskID, workItem.Name, workItem.Code);
     string response  = ProcessService.Execute(command, arguments, repository.Path);
 }