Compare commits

..
5 Commits
Author SHA1 Message Date
Anton.Volkov eff1bff375 fix 2020-06-09 14:03:30 +03:00
Anton.Volkov d8a47b7cd3 semver up 2020-06-09 14:02:01 +03:00
Anton.Volkov 95ce2792d9 Merge branch 'master' of https://github.com/monster1025/JiraTimeBot 2020-06-09 13:59:52 +03:00
d.kislov 325e7a30f5 Добавлен рекурсивный поиск .git директорий. 2020-06-03 14:43:51 +03:00
Anton.Volkov 9f95e918f7 Update GitLog.cs
Fix branch and issue detection
2020-05-28 10:56:06 +03:00
3 changed files with 52 additions and 41 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.83
1.0.86
+3 -3
View File
@@ -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.83")]
[assembly: AssemblyFileVersion("1.0.83")]
[assembly: AssemblyInformationalVersion("1.0.83")]
[assembly: AssemblyVersion("1.0.86")]
[assembly: AssemblyFileVersion("1.0.86")]
[assembly: AssemblyInformationalVersion("1.0.86")]
+20 -9
View File
@@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
namespace JiraTimeBot.RepositoryProviders
@@ -35,7 +36,7 @@ namespace JiraTimeBot.RepositoryProviders
date = date.GetValueOrDefault(DateTime.Now.Date);
var workTasks = new List<TaskTimeItem>();
foreach (var repoDirectory in Directory.GetDirectories(settings.RepositoryPath))
foreach (var repoDirectory in Directory.GetDirectories(settings.RepositoryPath, ".git", SearchOption.AllDirectories))
{
if (cancellationToken.IsCancellationRequested)
{
@@ -43,16 +44,15 @@ namespace JiraTimeBot.RepositoryProviders
}
//var project = new DirectoryInfo(repoDirectory).Name;
if (!Directory.Exists(Path.Combine(repoDirectory, ".git")))
var repoRootDirectory = repoDirectory.Replace(".git", "");
var directoryInfo = new DirectoryInfo(repoRootDirectory);
if (!directoryInfo.Exists)
{
continue;
}
var directoryInfo = new DirectoryInfo(repoDirectory);
var repo = new LibGit2Sharp.Repository(repoDirectory);
var repo = new LibGit2Sharp.Repository(repoRootDirectory);
if (settings.PullBeforeProcess)
{
try
@@ -78,7 +78,11 @@ namespace JiraTimeBot.RepositoryProviders
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)
var dateMatch = date.Value.Date == reflogItem.Committer.When.Date;
var userMatch = reflogItem.Committer.Email.Equals(settings.MercurialAuthorEmail, StringComparison.CurrentCultureIgnoreCase);
if (!dateMatch || !userMatch)
{
continue;
}
@@ -101,13 +105,20 @@ namespace JiraTimeBot.RepositoryProviders
continue;
}
var branch = ListBranchesContaininingCommit(repo, commit.Sha).Select(f => f.FriendlyName)
.Where(f => f.Contains("-") && !f.Contains("/")).Distinct().FirstOrDefault();
var regex = new Regex("[a-zA-Z]{1,4}-[0-9]{1,6}");
var branch = ListBranchesContaininingCommit(repo, commit.Sha)
.Select(f => f.FriendlyName)
.FirstOrDefault(f => regex.IsMatch(f));
//.Where(f => f.Contains("-") && !f.Contains("/")).Distinct().FirstOrDefault();
if (branch == null)
{
continue;
}
branch = regex.Match(branch).Value;
var commitMessage = commit.MessageShort;
commitMessage = _technicalInfoSkipper.StripBranchPrefix(branch, commitMessage);