More graceful error when running parallel git target

This commit is contained in:
Nate McMaster 2017-02-24 10:08:19 -08:00
parent ac096c217b
commit 6dfbab0b6c
2 changed files with 23 additions and 8 deletions

1
.gitignore vendored
View File

@ -43,6 +43,7 @@ project.lock.json
/HttpSysServer/
/IISIntegration/
/Identity/
/IdentityService/
/JsonPatch/
/KestrelHttpServer/
/Localization/

View File

@ -92,10 +92,24 @@ var buildTarget = "compile"
#update
@{
var errors = new List<string>();
Parallel.ForEach(repositories, repo =>
{
Git("pull --ff-only", repo);
try
{
Git("pull --ff-only", repo);
}
catch
{
errors.Add(repo);
}
});
if (errors.Count > 0)
{
Log.Info("Failed to pull: " + string.Join(", ", errors));
throw new InvalidOperationException("update failed");
}
}
#sync-commits
@ -562,13 +576,13 @@ var buildTarget = "compile"
#git-clean description='REMOVE ALL CHANGES to the working directory'
@{
Console.WriteLine("This runs `git clean -xfd` in all non-Universe repos.");
Console.WriteLine("This should REMOVE ALL CHANGES to the working directory.");
Console.Write("***** Are you sure? ***** (Y or anything else)? ");
if (Console.ReadLine() != "Y")
{
throw new Exception("git-clean cancelled");
}
// Console.WriteLine("This runs `git clean -xfd` in all non-Universe repos.");
// Console.WriteLine("This should REMOVE ALL CHANGES to the working directory.");
// Console.Write("***** Are you sure? ***** (Y or anything else)? ");
// if (Console.ReadLine() != "Y")
// {
// throw new Exception("git-clean cancelled");
// }
foreach(var repo in repositories)
{
GitClean(repo);