Beispiel #1
0
        private void loadBranchMergeFromBranch_DataSet()
        {
            List <GitConfigs.Branch> branchList = new List <GitConfigs.Branch>();

            if (dgvRepositories.SelectedRows.Count > 0)
            {
                GitConfigs.Repository repository = getRepository();
                branchList = settingsXml.BranchList.FindAll(x => x.EntityGuid.Equals(from branchItem in repository.repositoryBranchOrderList
                                                                                     where repository.EntityGuid.Equals(repository.EntityGuid)
                                                                                     select branchItem.BranchGuid.FirstOrDefault()));
            }
            else
            {
                branchList = settingsXml.BranchList;
            }

            if (dgvBranches.SelectedRows.Count > 0)
            {
                GitConfigs.Branch branch = settingsXml.BranchList.Find(x => x.EntityGuid == dgvBranches.SelectedRows[0].Cells["BranchGuid"].Value.ToString());

                if (branch != null)
                {
                    branchList.Remove(branch);
                }
            }

            BindingSource bBranceMergeSource = new BindingSource();

            bBranceMergeSource.DataSource      = branchList;
            cbBranchMergeFromBranch.DataSource = bBranceMergeSource;
            bBranceMergeSource.ResetBindings(true);
        }
Beispiel #2
0
        private string saveBranch()
        {
            GitConfigs.Branch recordObj;
            bool newRecord = false;

            GitConfigs.Branch branch = settingsXml.BranchList.Find(x => x.EntityGuid == dgvBranches.SelectedRows[0].Cells["BranchGuid"].Value.ToString());

            if (settingsXml.BranchList.Count == 0)
            {
                newRecord = true;
                recordObj = new GitConfigs.Branch();
            }
            else
            {
                recordObj = settingsXml.BranchList.Find(x => x.EntityGuid == txtBranchGuid.Text);
                if (recordObj == null)
                {
                    newRecord = true;
                    recordObj = new GitConfigs.Branch();
                }
            }

            recordObj.EntityName     = txtBranchName.Text;
            recordObj.UndoAnyChanges = chkBranchUndoAnyChanges.Checked;
            recordObj.Active         = chkBranchActive.Checked;

            if (cbBranchMergeFromBranch.SelectedIndex != -1)
            {
                recordObj.MergeFromBranchEntityGuid = cbBranchMergeFromBranch.SelectedValue.ToString();
            }

            if (newRecord)
            {
                if (txtBranchGuid.Text == String.Empty)
                {
                    btnBranchGenerateGuid_Click(null, null);
                }

                recordObj.EntityGuid = txtBranchGuid.Text;
                settingsXml.BranchList.Add(recordObj);
            }

            return(recordObj.EntityGuid);
        }
Beispiel #3
0
        private DataTable getBranchesByRepository(DataTable dtBranches, GitConfigs.Repository repository)
        {
            foreach (GitConfigs.RepositoryBranchOrder repositoryBranchOrderItem in repository.repositoryBranchOrderList)
            {
                GitConfigs.Branch branch = settingsXml.BranchList.Find(x => x.EntityGuid == repositoryBranchOrderItem.BranchGuid);

                if (branch.Active)
                {
                    var newRow = dtBranches.NewRow();

                    newRow["Repository"] = repository.EntityName;
                    newRow["Name"]       = branch.EntityName;
                    newRow["Guid"]       = branch.EntityGuid;

                    dtBranches.Rows.Add(newRow);
                }
            }

            return(dtBranches);
        }
Beispiel #4
0
        private void dgvBranches_SelectionChanged(object sender, EventArgs e)
        {
            if (dgvBranches.SelectedRows.Count > 0)
            {
                GitConfigs.Branch branch = settingsXml.BranchList.Find(x => x.EntityGuid == dgvBranches.SelectedRows[0].Cells["BranchGuid"].Value.ToString());

                txtBranchGuid.Text              = branch.EntityGuid;
                txtBranchName.Text              = branch.EntityName;
                chkBranchPullFirst.Checked      = branch.PullFirst;
                chkBranchUndoAnyChanges.Checked = branch.UndoAnyChanges;
                chkBranchActive.Checked         = branch.Active;

                rdBranchEditMode.Checked = true;

                txtBranchGuid.Enabled    = false;
                rdBranchEditMode.Enabled = true;
                rdBranchAppliesToAllRepositoriesAllProjects.Checked      = false;
                rdBranchAppliesToAllRepositoriesInCurrentProject.Checked = false;
                rdBranchAppliesToAllRepositoriesInCurrentProject.Enabled = false;
                rdBranchAppliesToSpecificRepositories.Enabled            = false;

                loadBranchMergeFromBranch_DataSet();
            }
        }