Compare commits

..
2 Commits
9 changed files with 105 additions and 85 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.59 1.0.61
@@ -46,28 +46,28 @@ namespace JiraTimeBot.JiraIntegration
{ {
foreach (var comment in userComments.OrderBy(f=>f.CreatedDate)) foreach (var comment in userComments.OrderBy(f=>f.CreatedDate))
{ {
workTasks.Add(new TaskTimeItem var item = new TaskTimeItem(issue.Key.Value,
{ issue.Summary,
StartTime = issue.Updated.GetValueOrDefault(date.Value), issue.Project,
Description = issue.Summary, issue.Updated.GetValueOrDefault(date.Value),
Branch = issue.Key.Value, TimeSpan.Zero,
FilesAffected = 1, 1,
Commits = 1, 1,
Type = CommitType.Task CommitType.Task);
}); workTasks.Add(item);
} }
} }
else else
{ {
workTasks.Add(new TaskTimeItem var item = new TaskTimeItem(issue.Key.Value,
{ issue.Summary,
StartTime = issue.Updated.GetValueOrDefault(date.Value), issue.Project,
Description = issue.Summary, issue.Updated.GetValueOrDefault(date.Value),
Branch = issue.Key.Value, TimeSpan.Zero,
FilesAffected = 1, 1,
Commits = 1, 1,
Type = CommitType.Task CommitType.Task);
}); workTasks.Add(item);
} }
} }
+1
View File
@@ -92,6 +92,7 @@
<Compile Include="Mercurial\IMercurialLog.cs" /> <Compile Include="Mercurial\IMercurialLog.cs" />
<Compile Include="Mercurial\Modifiers\TechnicalInfoSkipper.cs" /> <Compile Include="Mercurial\Modifiers\TechnicalInfoSkipper.cs" />
<Compile Include="TasksProcessors\IAllTasksProcessors.cs" /> <Compile Include="TasksProcessors\IAllTasksProcessors.cs" />
<Compile Include="TaskTime\Objects\CommitType.cs" />
<Compile Include="TaskTime\TaskTimeSpread.cs" /> <Compile Include="TaskTime\TaskTimeSpread.cs" />
<Compile Include="UI\frmMain.cs"> <Compile Include="UI\frmMain.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
+11 -11
View File
@@ -48,6 +48,8 @@ namespace JiraTimeBot.Mercurial
continue; continue;
} }
var directoryInfo = new DirectoryInfo(repoDirectory);
var repo = new Repository(repoDirectory); var repo = new Repository(repoDirectory);
var logCommand = new LogCommand var logCommand = new LogCommand
{ {
@@ -72,16 +74,14 @@ namespace JiraTimeBot.Mercurial
} }
commitMessage = _technicalInfoSkipper.StripTechnicalInfo(commitMessage); commitMessage = _technicalInfoSkipper.StripTechnicalInfo(commitMessage);
var task = new TaskTimeItem var task = new TaskTimeItem(changeset.Branch,
{ commitMessage,
StartTime = changeset.Timestamp, directoryInfo.Name,
Description = commitMessage, changeset.Timestamp,
Branch = changeset.Branch, TimeSpan.Zero,
FilesAffected = changeset.PathActions.Count, 1,
Commits = 1, changeset.PathActions.Count,
TimeSpent = TimeSpan.Zero, GetCommitType(changeset.Branch));
Type = GetCommitType(changeset.Branch)
};
if (task.Type == CommitType.Release && task.Description.StartsWith("Merge with", StringComparison.CurrentCultureIgnoreCase)) if (task.Type == CommitType.Release && task.Description.StartsWith("Merge with", StringComparison.CurrentCultureIgnoreCase))
{ {
@@ -94,7 +94,7 @@ namespace JiraTimeBot.Mercurial
var release = task.Branch.Replace("release", ""); var release = task.Branch.Replace("release", "");
task.Branch = branch; task.Branch = branch;
task.Description = $"Подготовка и публикация версии {release}."; task.Description = $"Подготовка и публикация версии {task.Project} {release}.";
} }
workTasks.Add(task); workTasks.Add(task);
_log?.Trace($" - Найден changeset: {changeset.Timestamp} - {changeset.Branch} - {changeset.AuthorEmailAddress} - {commitMessage}"); _log?.Trace($" - Найден changeset: {changeset.Timestamp} - {changeset.Branch} - {changeset.AuthorEmailAddress} - {commitMessage}");
+31 -31
View File
@@ -1,31 +1,31 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("JiraTimeBot")] [assembly: AssemblyTitle("JiraTimeBot")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JiraTimeBot")] [assembly: AssemblyProduct("JiraTimeBot")]
[assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // 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 // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")] [assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.59")] [assembly: AssemblyVersion("1.0.61")]
[assembly: AssemblyFileVersion("1.0.59")] [assembly: AssemblyFileVersion("1.0.61")]
[assembly: AssemblyInformationalVersion("1.0.59")] [assembly: AssemblyInformationalVersion("1.0.61")]
@@ -0,0 +1,7 @@
namespace JiraTimeBot.TaskTime.Objects
{
public enum CommitType {
Task = 0,
Release = 1
}
}
@@ -11,10 +11,19 @@ namespace JiraTimeBot.TaskTime.Objects
public int Commits { get; set; } public int Commits { get; set; }
public int FilesAffected { get; set; } public int FilesAffected { get; set; }
public CommitType Type { get; set; } public CommitType Type { get; set; }
} public string Project { get; set; }
public enum CommitType { public TaskTimeItem(string branch, string description, string project, DateTime startTime, TimeSpan timeSpent, int commits,
Task = 0, int filesAffected = 1, CommitType type = CommitType.Task)
Release = 1 {
Branch = branch;
Description = description;
Project = project;
Commits = commits;
TimeSpent = timeSpent;
StartTime = startTime;
FilesAffected = filesAffected;
Type = type;
}
} }
} }
@@ -93,13 +93,14 @@ namespace JiraTimeBot.TaskTime
//Если указана задача контроля времени - то спишем туда 30 минут и вычеркнем их из общего рабочего времени. //Если указана задача контроля времени - то спишем туда 30 минут и вычеркнем их из общего рабочего времени.
if (!string.IsNullOrEmpty(timeControlTask)) if (!string.IsNullOrEmpty(timeControlTask))
{ {
return new TaskTimeItem return new TaskTimeItem(timeControlTask,
{ "Ведение учета времени",
TimeSpent = TimeSpan.FromMinutes(minutes), "Service",
Branch = timeControlTask, DateTime.Now,
Commits = 1, TimeSpan.FromMinutes(minutes),
Description = "Ведение учета времени" 1,
}; 1,
CommitType.Task);
} }
return null; return null;
+15 -13
View File
@@ -34,19 +34,21 @@ namespace JiraTimeBot.TaskTime
{ {
sb.AppendLine($"- {task.Description}"); sb.AppendLine($"- {task.Description}");
} }
var taskTimeItem = new TaskTimeItem
{ var timeSpent = appendTime
Branch = taskGroup.Key, ? TimeSpan.FromMinutes(taskGroup.Sum(f => f.TimeSpent.TotalMinutes)) +
TimeSpent = appendTime ? TimeSpan.FromMinutes(currentTaskTime)
TimeSpan.FromMinutes(taskGroup.Sum(f=>f.TimeSpent.TotalMinutes)) + TimeSpan.FromMinutes(currentTaskTime): : TimeSpan.FromMinutes(currentTaskTime);
TimeSpan.FromMinutes(currentTaskTime)
, var taskTimeItem = new TaskTimeItem(
Commits = taskGroup.Sum(f=>f.Commits), taskGroup.Key,
Description = sb.ToString(), sb.ToString(),
StartTime = taskGroup.Min(f=>f.StartTime), taskGroup.First().Project,
FilesAffected = taskGroup.Sum(f=>f.FilesAffected), taskGroup.Min(f => f.StartTime),
Type = taskGroup.First().Type timeSpent,
}; taskGroup.Sum(f => f.Commits),
taskGroup.Sum(f => f.FilesAffected),
taskGroup.First().Type);
newList.Add(taskTimeItem); newList.Add(taskTimeItem);
} }