コード例 #1
0
        private void btn_commitRemoteRepo_Click(object sender, EventArgs e)
        {
            DialogResult ret = MessageBox.Show("Are you sure ?", "Waring", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (ret == DialogResult.Yes)
            {
                string branch, remoteName;

                frm_Input frm = new frm_Input();
                frm.title = "What is remote name (ex: origin) ?";
                frm.text  = "Enter remote name: ";
                frm.ShowDialog();

                if (frm.isOK == false)
                {
                    MessageBox.Show("Cannceled !!!");
                    return;
                }
                remoteName = frm.result;


                frm_Input frm2 = new frm_Input();
                frm2.title = "What is branch name (ex: master) ?";
                frm2.text  = "Enter branch name: ";
                frm2.ShowDialog();

                if (frm2.isOK == false)
                {
                    MessageBox.Show("Cannceled !!!");
                    return;
                }

                branch = frm2.result;

                //remove old remote repo
                this.rtb_Result.Text += DateTime.Now.ToLongTimeString() + ": remove old remote repo \n";
                var cmd = " remote rm " + remoteName + "";
                this.rtb_Result.Text += myclass.Do2(cmd, this.txt_FolderProject.Text);
                this.rtb_Result.Text += "Removed !!! " + folderBrowserDialog_AddFolder.SelectedPath + "\n------------------------------------------------------------\n";

                //add new remote repo
                this.rtb_Result.Text += DateTime.Now.ToLongTimeString() + ": Add new remote repo\n";
                cmd = "remote add " + remoteName + " " + this.txt_RemoteLink.Text;
                this.rtb_Result.Text += myclass.Do2(cmd, this.txt_FolderProject.Text);
                this.rtb_Result.Text += "Added " + folderBrowserDialog_AddFolder.SelectedPath + "\n------------------------------------------------------------\n";

                //pull
                this.rtb_Result.Text += DateTime.Now.ToLongTimeString() + ": Working.....\n";
                cmd = " pull " + remoteName + " " + branch + " --allow-unrelated-histories";
                this.rtb_Result.Text += myclass.Do2(cmd, this.txt_FolderProject.Text);
                this.rtb_Result.Text += "Pull done " + folderBrowserDialog_AddFolder.SelectedPath + "\n------------------------------------------------------------\n";

                //push
                this.rtb_Result.Text += DateTime.Now.ToLongTimeString() + ": Working.....\n";
                cmd = "push -u " + remoteName + " " + branch;
                this.rtb_Result.Text += myclass.Do2(cmd, this.txt_FolderProject.Text);
                this.rtb_Result.Text += "Push done " + folderBrowserDialog_AddFolder.SelectedPath + "\n------------------------------------------------------------\n";
            }
        }
コード例 #2
0
        private void btn_Submit_Click(object sender, EventArgs e)
        {
            frm_Input frm = new frm_Input();

            frm.title = "What is version  (ex: Version 1.0) ?";
            frm.text  = "Enter version : ";
            frm.ShowDialog();

            if (frm.isOK == false)
            {
                MessageBox.Show("Cannceled !!!");
                return;
            }



            this.rtb_Result.Text += DateTime.Now.ToLongTimeString() + ": Working.....\n";
            this.rtb_Result.Text += myclass.Do(" commit -a -m " + '"' + frm.result + '"', this.txt_FolderProject.Text);
            this.rtb_Result.Text += "Done " + folderBrowserDialog_AddFolder.SelectedPath + "\n------------------------------------------------------------\n";
        }