Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
387d53b928 | ||
|
|
df63a96d3e | ||
|
|
883cae9c25 | ||
|
|
6188da74d2 | ||
|
|
90912664bf |
+1
-1
@@ -1 +1 @@
|
||||
1.0.73
|
||||
1.0.78
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using JiraTimeBot.Configuration;
|
||||
using JiraTimeBot.Mercurial.Modifiers;
|
||||
using JiraTimeBot.TaskTime.Objects;
|
||||
using LibGit2Sharp;
|
||||
using LibGit2Sharp.Handlers;
|
||||
|
||||
namespace JiraTimeBot.Mercurial
|
||||
{
|
||||
@@ -73,15 +71,31 @@ namespace JiraTimeBot.Mercurial
|
||||
_log?.Trace($" - Не получается сделать pull для репозитория: {directoryInfo.Name} - {ex.Message}");
|
||||
}
|
||||
}
|
||||
var filter = new CommitFilter { SortBy = CommitSortStrategies.Time };
|
||||
|
||||
foreach (Commit commit in repo.Commits.QueryBy(filter).Take(200))
|
||||
var allCommits = new List<Commit>();
|
||||
|
||||
var reflog = repo.Refs.Log(repo.Refs.Head);
|
||||
foreach (var reflogItem in reflog)
|
||||
{
|
||||
if (reflogItem.Committer.When.Date != date.Value.Date || reflogItem.Committer.Email != settings.MercurialAuthorEmail)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var commit = repo.Lookup<LibGit2Sharp.Commit>(reflogItem.To.Sha);
|
||||
if (commit != null && allCommits.All(f => f.Sha != commit.Sha))
|
||||
{
|
||||
allCommits.Add(commit);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Commit commit in allCommits)
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
return new List<TaskTimeItem>();
|
||||
}
|
||||
if (commit.Author.When.DateTime.Date != date || commit.Author.Email != settings.MercurialAuthorEmail)
|
||||
if (commit.Author.When.DateTime.Date != date.Value.Date || commit.Author.Email != settings.MercurialAuthorEmail)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -94,10 +108,13 @@ namespace JiraTimeBot.Mercurial
|
||||
}
|
||||
|
||||
var commitMessage = commit.MessageShort;
|
||||
commitMessage = _technicalInfoSkipper.StripBranchPrefix(branch, commitMessage);
|
||||
|
||||
if (_commitSkipper.IsNeedToSkip(branch, commitMessage))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
commitMessage = _technicalInfoSkipper.StripTechnicalInfo(commitMessage);
|
||||
var files = FilesToMerge(commit, repo);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace JiraTimeBot.Mercurial.Modifiers
|
||||
//Пропускаем Close и Merge коммиты
|
||||
if (commitMessage.StartsWith($"Close {branch}", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
commitMessage.StartsWith($"Merge with", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
commitMessage.StartsWith($"Merged", StringComparison.InvariantCultureIgnoreCase) ||
|
||||
commitMessage.StartsWith($"Merge branch", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{
|
||||
public interface ITechnicalInfoSkipper
|
||||
{
|
||||
string StripBranchPrefix(string branch, string commitMessage);
|
||||
string StripTechnicalInfo(string commitMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace JiraTimeBot.Mercurial.Modifiers
|
||||
{
|
||||
public class TechnicalInfoSkipper : ITechnicalInfoSkipper
|
||||
{
|
||||
public string StripBranchPrefix(string branch, string commitMessage)
|
||||
{
|
||||
if (commitMessage.StartsWith(branch, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return commitMessage.TrimStart(branch.ToCharArray()).Trim();
|
||||
}
|
||||
|
||||
var quotedBranch = $"[{branch}]";
|
||||
if (commitMessage.StartsWith(quotedBranch, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return commitMessage.TrimStart(quotedBranch.ToCharArray()).Trim();
|
||||
}
|
||||
|
||||
return commitMessage;
|
||||
}
|
||||
|
||||
public string StripTechnicalInfo(string commitMessage)
|
||||
{
|
||||
if (!commitMessage.Contains("Signed-by:"))
|
||||
|
||||
@@ -26,6 +26,6 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.73")]
|
||||
[assembly: AssemblyFileVersion("1.0.73")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.73")]
|
||||
[assembly: AssemblyVersion("1.0.78")]
|
||||
[assembly: AssemblyFileVersion("1.0.78")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.78")]
|
||||
|
||||
Reference in New Issue
Block a user