Esempio n. 1
0
        public void Clean()
        {
            log.Info($"{"[" + ModuleName + "]",-30}Clean and reset hard");
            var gitIgnore = Path.Combine(RepoPath, ".gitignore");

            if (File.Exists(gitIgnore))
            {
                File.Delete(gitIgnore);
            }
            log.Info($"{"[" + ModuleName + "]",-30}Remove from built cache");
            BuiltHelper.RemoveModuleFromBuiltInfo(ModuleName);

            var exitCode = runner.RunInDirectory(RepoPath, "git clean -f -d -q");

            if (exitCode != 0)
            {
                throw new GitLocalChangesException($"Failed to clean local changes in {RepoPath}. Error message:\n{runner.Errors}");
            }

            exitCode = runner.RunInDirectory(RepoPath, "git reset --hard");
            if (exitCode != 0)
            {
                throw new GitLocalChangesException($"Failed to reset local changes in {RepoPath}. Error message:\n{runner.Errors}");
            }
        }
Esempio n. 2
0
 public void ResetHard(string treeish = null)
 {
     log.Info($"{"[" + ModuleName + "]",-30}Reset hard {treeish}");
     BuiltHelper.RemoveModuleFromBuiltInfo(ModuleName);
     runner.RunInDirectory(RepoPath, "git reset --hard " + (treeish == null ? "" : ("origin/" + treeish)));
 }