add try...catch
Докинул try catch, ибо иногда падал и было непонятно на каком репозитории
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
<SolutionConfiguration>
|
||||||
|
<Settings>
|
||||||
|
<AllowParallelTestExecution>True</AllowParallelTestExecution>
|
||||||
|
<SolutionConfigured>True</SolutionConfigured>
|
||||||
|
</Settings>
|
||||||
|
</SolutionConfiguration>
|
||||||
@@ -7,8 +7,10 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.ServiceModel.Channels;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace JiraTimeBot.RepositoryProviders
|
namespace JiraTimeBot.RepositoryProviders
|
||||||
{
|
{
|
||||||
@@ -72,49 +74,58 @@ namespace JiraTimeBot.RepositoryProviders
|
|||||||
AdditionalArguments = { "--encoding=utf-8" },
|
AdditionalArguments = { "--encoding=utf-8" },
|
||||||
};
|
};
|
||||||
|
|
||||||
var log = repo.Log(logCommand);
|
try
|
||||||
|
|
||||||
foreach (var changeset in log)
|
|
||||||
{
|
{
|
||||||
if (cancellationToken.IsCancellationRequested)
|
var log = repo.Log(logCommand);
|
||||||
{
|
|
||||||
return new List<TaskTimeItem>();
|
|
||||||
}
|
|
||||||
|
|
||||||
var commitMessage = FixEncoding(changeset.CommitMessage);
|
foreach (var changeset in log)
|
||||||
if (_commitSkipper.IsNeedToSkip(changeset.Branch, commitMessage))
|
|
||||||
{
|
{
|
||||||
continue;
|
if (cancellationToken.IsCancellationRequested)
|
||||||
}
|
|
||||||
commitMessage = _technicalInfoSkipper.StripTechnicalInfo(commitMessage);
|
|
||||||
|
|
||||||
var task = new TaskTimeItem(changeset.Branch,
|
|
||||||
commitMessage,
|
|
||||||
directoryInfo.Name,
|
|
||||||
changeset.Timestamp,
|
|
||||||
TimeSpan.Zero,
|
|
||||||
1,
|
|
||||||
changeset.PathActions.Count,
|
|
||||||
"",
|
|
||||||
GetCommitType(changeset.Branch));
|
|
||||||
|
|
||||||
if (task.Type == CommitType.Release && task.Description.StartsWith("Merge with", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
var description = task.Description;
|
|
||||||
if (description.Contains("\n"))
|
|
||||||
{
|
{
|
||||||
description = description.Split('\n')[0];
|
return new List<TaskTimeItem>();
|
||||||
}
|
}
|
||||||
var branch = description.Replace("Merge with", "").Replace(" ", "");
|
|
||||||
var release = task.Branch.Replace("release", "");
|
|
||||||
|
|
||||||
task.Branch = branch;
|
var commitMessage = FixEncoding(changeset.CommitMessage);
|
||||||
task.Description = $"Подготовка и публикация версии {task.Project} {release}.";
|
if (_commitSkipper.IsNeedToSkip(changeset.Branch, commitMessage))
|
||||||
task.ReleaseVersion = release;
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
commitMessage = _technicalInfoSkipper.StripTechnicalInfo(commitMessage);
|
||||||
|
|
||||||
|
var task = new TaskTimeItem(changeset.Branch,
|
||||||
|
commitMessage,
|
||||||
|
directoryInfo.Name,
|
||||||
|
changeset.Timestamp,
|
||||||
|
TimeSpan.Zero,
|
||||||
|
1,
|
||||||
|
changeset.PathActions.Count,
|
||||||
|
"",
|
||||||
|
GetCommitType(changeset.Branch));
|
||||||
|
|
||||||
|
if (task.Type == CommitType.Release && task.Description.StartsWith("Merge with", StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
var description = task.Description;
|
||||||
|
if (description.Contains("\n"))
|
||||||
|
{
|
||||||
|
description = description.Split('\n')[0];
|
||||||
|
}
|
||||||
|
var branch = description.Replace("Merge with", "").Replace(" ", "");
|
||||||
|
var release = task.Branch.Replace("release", "");
|
||||||
|
|
||||||
|
task.Branch = branch;
|
||||||
|
task.Description = $"Подготовка и публикация версии {task.Project} {release}.";
|
||||||
|
task.ReleaseVersion = release;
|
||||||
|
}
|
||||||
|
workTasks.Add(task);
|
||||||
|
_log?.Trace($" - Найден changeset: {changeset.Timestamp} - {changeset.Branch} - {changeset.AuthorEmailAddress} - {commitMessage}");
|
||||||
}
|
}
|
||||||
workTasks.Add(task);
|
|
||||||
_log?.Trace($" - Найден changeset: {changeset.Timestamp} - {changeset.Branch} - {changeset.AuthorEmailAddress} - {commitMessage}");
|
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Oops something went wrong in repo {repoDirectory}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!workTasks.Any())
|
if (!workTasks.Any())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user