Ejemplo n.º 1
0
        private void m_btnSwitch_Click(object sender, EventArgs e)
        {
            if (m_oGitRepository.m_bIsValidCommite == false)
                return;

            try
            {
                Form_Repo_SwitchBranch SwitchDlg = new Form_Repo_SwitchBranch(this);
                string szBrName = m_szWorkingDir;

                SwitchDlg.InitTarget(szBrName,m_txCurrenBranch.Text);
                if (DialogResult.OK == SwitchDlg.ShowDialog(this))
                {
                    GetALLBranches();
                    RefreshReferMap();
                    RefreshGUI(false);
                }
            }
            catch
            {
                Debug.Assert(false);
            }
            return;
        }
Ejemplo n.º 2
0
        private void m_MIM_SwitchBranch_Click(object sender, EventArgs e)
        {
            try
            {
                Form_Repo_SwitchBranch SwitchDlg = new Form_Repo_SwitchBranch(this);
                string szSHA = m_lvCommitsInfo.FocusedItem.Tag.ToString();
                string szBrName = string.Empty;
                foreach (string szItm in m_oGitRepository.m_mapLocalBranch.Keys)
                {
                    if(m_oGitRepository.m_mapLocalBranch[szItm].Equals(szSHA))
                    {
                        szBrName = szItm;
                        break;
                    }
                }
                if(string.IsNullOrEmpty(szBrName))
                {
                    MessageBox.Show(this, "This commit is not a branch HEAD", "Warning");
                    return;
                }

                SwitchDlg.InitTarget(szBrName, m_txCurrenBranch.Text);
                if (DialogResult.OK == SwitchDlg.ShowDialog(this))
                {
                    GetALLBranches();
                    RefreshGUI(false);
                }
            }
            catch
            {
                Debug.Assert(false);
            }
            return;
        }