示例#1
0
        /// <summary>
        /// Git 初始化 init Add Commit Remote
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InitGit_toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            string blogDir = Program.GetBlogDir().Replace("\\", "/");
            string gitpwd  = Program.GetConfig().Deployment.deploy;

            if (string.IsNullOrWhiteSpace(gitpwd) || File.Exists(gitpwd))
            {
                MessageBox.Show("Git Bush 路径错误!");
                return;
            }
            Common.GitHelper git = new Common.GitHelper(blogDir);
            git.Init(blogDir);
            return;

            git.Add(blogDir);
            git.Commit(blogDir, "commit" + DateTime.Now.ToString());
            if (string.IsNullOrWhiteSpace(Program.GetConfig().Deployment.repository))
            {
                MessageBox.Show("Git远程地址错误!");
                return;
            }
            if (string.IsNullOrWhiteSpace(Program.GetConfig().Deployment.username) || string.IsNullOrWhiteSpace(Program.GetConfig().Deployment.password))
            {
                MessageBox.Show("Git远程用户错误!");
                return;
            }
            git.Remote(blogDir, Program.GetConfig().Deployment.repository, Program.GetConfig().Deployment.username, Program.GetConfig().Deployment.password);
        }
示例#2
0
        private void Git_Push_ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            string blogDir = Program.GetBlogDir().Replace("\\", "/");
            string gitpwd  = Program.GetConfig().Deployment.deploy;

            if (string.IsNullOrWhiteSpace(gitpwd) || !File.Exists(gitpwd))
            {
                MessageBox.Show("Git Bush 路径错误!");
                return;
            }
            Common.GitHelper git = new Common.GitHelper(blogDir);
            if (git.Push(blogDir))
            {
                MessageBox.Show("推送成功!");
            }
            else
            {
                MessageBox.Show("推送失败!");
            }
        }
示例#3
0
        private void Git_Commit_ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string blogDir = Program.GetBlogDir().Replace("\\", "/");
            string gitpwd  = Program.GetConfig().Deployment.deploy;

            if (string.IsNullOrWhiteSpace(gitpwd) || !File.Exists(gitpwd))
            {
                MessageBox.Show("Git Bush 路径错误!");
                return;
            }
            Common.GitHelper git = new Common.GitHelper(blogDir);
            if (git.Add(blogDir) && git.Commit(blogDir, "commit" + DateTime.Now.ToString()))
            {
                MessageBox.Show("提交成功!");
            }
            else
            {
                MessageBox.Show("提交失败!");
            }
        }
示例#4
0
        private void Git_Init_ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string blogDir = Program.GetBlogDir().Replace("\\", "/");
            string gitpwd  = Program.GetConfig().Deployment.deploy;

            if (string.IsNullOrWhiteSpace(gitpwd) || !File.Exists(gitpwd))
            {
                MessageBox.Show("Git Bush 路径错误!");
                return;
            }
            Common.GitHelper git = new Common.GitHelper(gitpwd);
            if (git.Init(blogDir) && git.RmRemote(blogDir) && git.Remote(blogDir, Program.GetConfig().Deployment.repository, Program.GetConfig().Deployment.username, Program.GetConfig().Deployment.password))
            {
                MessageBox.Show("初始化成功!");
            }
            else
            {
                MessageBox.Show("初始化失败!");
            }
        }