Exemple #1
0
        private void UndoByGitCheckout()
        {
            GitExecuter gitExecuter = new GitExecuter(ExeFileHelper.GetGitExePath(), SolutionConfig.AbsolutePath);

            bool success = gitExecuter.Execute("checkout *.csproj", out string result, out string err);

            if (!success)
            {
                throw new InvalidOperationException($"哎呀,恢复 csproj 文件时出错了:{err}");
            }

            success = gitExecuter.Execute("checkout *.sln", out string result2, out string err2);
            if (!success)
            {
                throw new InvalidOperationException($"哎呀,恢复 sln 文件时出错了:{err2}");
            }
        }
Exemple #2
0
        private void CheckCanChange()
        {
            GitExecuter gitExecuter = new GitExecuter(ExeFileHelper.GetGitExePath(), SolutionConfig.AbsolutePath);

            bool success = gitExecuter.Execute("status", out string result, out string err);

            if (!success)
            {
                throw new InvalidOperationException(err);
            }

            if (result.Contains(".csproj"))
            {
                throw new InvalidOperationException("有尚未提交的对 csproj 文件的修改,请先撤销或者提交这些修改");
            }

            if (result.Contains(".sln"))
            {
                throw new InvalidOperationException("有尚未提交的对 sln 文件的修改,请先撤销或者提交这些修改");
            }
        }