Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6188da74d2 | ||
|
|
90912664bf | ||
|
|
2b9799b5b7 | ||
|
|
553f581537 |
+1
-1
@@ -1 +1 @@
|
||||
1.0.72
|
||||
1.0.75
|
||||
|
||||
@@ -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 };
|
||||
|
||||
var allCommits = new List<Commit>();
|
||||
|
||||
foreach (Commit commit in repo.Commits.QueryBy(filter).Take(200))
|
||||
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;
|
||||
}
|
||||
@@ -99,6 +113,7 @@ namespace JiraTimeBot.Mercurial
|
||||
continue;
|
||||
}
|
||||
commitMessage = _technicalInfoSkipper.StripTechnicalInfo(commitMessage);
|
||||
var files = FilesToMerge(commit, repo);
|
||||
|
||||
var task = new TaskTimeItem(branch,
|
||||
commitMessage,
|
||||
@@ -106,51 +121,13 @@ namespace JiraTimeBot.Mercurial
|
||||
commit.Committer.When.DateTime,
|
||||
TimeSpan.Zero,
|
||||
1,
|
||||
1, //changeset.PathActions.Count,
|
||||
files.Length, //changeset.PathActions.Count,
|
||||
"",
|
||||
GetCommitType(branch));
|
||||
workTasks.Add(task);
|
||||
|
||||
_log?.Trace($" - Найден commit: {commit.Committer.When.DateTime} - {branch} - {commit.Author.Email} - {commitMessage}");
|
||||
}
|
||||
|
||||
//foreach (var changeset in log)
|
||||
//{
|
||||
|
||||
// var commitMessage = FixEncoding(changeset.CommitMessage);
|
||||
// if (_commitSkipper.IsNeedToSkip(changeset.Branch, commitMessage))
|
||||
// {
|
||||
// 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}");
|
||||
//}
|
||||
}
|
||||
if (!workTasks.Any())
|
||||
{
|
||||
@@ -165,16 +142,19 @@ namespace JiraTimeBot.Mercurial
|
||||
return branch.StartsWith("release") ? CommitType.Release : CommitType.Task;
|
||||
}
|
||||
|
||||
private string FixEncoding(string source)
|
||||
public String[] FilesToMerge(Commit commit, Repository repo)
|
||||
{
|
||||
//перекодируем сообщение - ибо оно криво забирается в 1252
|
||||
Encoding srcEncodingFormat = Encoding.GetEncoding("windows-1252");
|
||||
byte[] originalByteString = srcEncodingFormat.GetBytes(source);
|
||||
var commitMessage = Encoding.UTF8.GetString(originalByteString);
|
||||
return commitMessage;
|
||||
var fileList = new List<String>();
|
||||
foreach (var parent in commit.Parents)
|
||||
{
|
||||
foreach (TreeEntryChanges change in repo.Diff.Compare<TreeChanges>(parent.Tree, commit.Tree))
|
||||
{
|
||||
fileList.Add(change.Path);
|
||||
}
|
||||
}
|
||||
return fileList.ToArray();
|
||||
}
|
||||
|
||||
|
||||
private IEnumerable<Branch> ListBranchesContaininingCommit(Repository repo, string commitSha)
|
||||
{
|
||||
bool directBranchHasBeenFound = false;
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("JiraTimeBot")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("JiraTimeBot")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// 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.72")]
|
||||
[assembly: AssemblyFileVersion("1.0.72")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.72")]
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("JiraTimeBot")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("JiraTimeBot")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// 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.75")]
|
||||
[assembly: AssemblyFileVersion("1.0.75")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.75")]
|
||||
|
||||
Reference in New Issue
Block a user