Exemple #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}");
            }
        }
 private bool IsModuleUpdate(Dictionary <string, string> currentCommitHashes, Dep module)
 {
     return
         (!modulesWithDeps.ContainsKey(module) ||
          modulesWithDeps[module].Any(
              dep => !currentCommitHashes.ContainsKey(dep.Dep.Name) ||
              currentCommitHashes[dep.Dep.Name] != dep.CommitHash ||
              !BuiltHelper.HasAllOutput(dep.Dep.Name, dep.Dep.Configuration, false)) ||
          !BuiltHelper.HasAllOutput(module.Name, module.Configuration, false));
 }
Exemple #3
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)));
 }