Пример #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}");
            }
        }
Пример #2
0
 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));
 }
Пример #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)));
 }