Compare commits

..
7 Commits
10 changed files with 388 additions and 306 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.89 1.0.94
+1 -1
View File
@@ -13,7 +13,7 @@
- Путь до репо (Режим Mercurial, Git) - путь до папки, в которую клонируются исходники. - Путь до репо (Режим Mercurial, Git) - путь до папки, в которую клонируются исходники.
- Jira URL - адрес Jira-сервреа. - Jira URL - адрес Jira-сервреа.
- Логин Jira - Логин в Jira (от этого пользователя будем выполнять запросы и вносить время). - Логин Jira - Логин в Jira (от этого пользователя будем выполнять запросы и вносить время).
- Пароль Jira - шифруется через DPAPI. - Пароль Jira - шифруется через DPAPI (может быть JSessionID - если длинна = 32 (!)).
- Mercurial Name (Режим Mercurial) - обязателен к указанию для режима Mercurial - имя пользователя Mercurial, от которого проходят коммиты (именно UserName, не E-Mail). - Mercurial Name (Режим Mercurial) - обязателен к указанию для режима Mercurial - имя пользователя Mercurial, от которого проходят коммиты (именно UserName, не E-Mail).
- Округление времени - Для красоты распределения времени тут устанавливается округление. По умолчанию - 15 минут, получим время 1:15, 0:30 итд. Остаток нераспределенного времени будет внесен в самую долгую задачу или же если это невозможно - количество рабочего времени будет увеличено или уменьшено. - Округление времени - Для красоты распределения времени тут устанавливается округление. По умолчанию - 15 минут, получим время 1:15, 0:30 итд. Остаток нераспределенного времени будет внесен в самую долгую задачу или же если это невозможно - количество рабочего времени будет увеличено или уменьшено.
- JQL (Режим Jira) - можно задать свой JQL для поиска задач. Возможные замены: %USER% - Логин Jira, %DATE% дата на которую формируем список. Значнеие по умолчанию: status changed by '%USER%' during ("%DATE%","%DATE%") - JQL (Режим Jira) - можно задать свой JQL для поиска задач. Возможные замены: %USER% - Логин Jira, %DATE% дата на которую формируем список. Значнеие по умолчанию: status changed by '%USER%' during ("%DATE%","%DATE%")
+38 -26
View File
@@ -1,26 +1,38 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup> </startup>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" /> <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.1.2.0" newVersion="5.1.2.0" /> <bindingRedirect oldVersion="0.0.0.0-6.2.0.0" newVersion="6.2.0.0" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" /> <bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" /> <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> <dependentAssembly>
</runtime> <assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
</configuration> <bindingRedirect oldVersion="0.0.0.0-106.11.7.0" newVersion="106.11.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RestSharp;
using RestSharp.Authenticators;
namespace JiraTimeBot.JiraIntegration.Authentificators
{
public class JSessionAuthenticator : AuthenticatorBase
{
public JSessionAuthenticator(string jSessionId) : base(jSessionId)
{
}
protected override Parameter GetAuthenticationParameter(string token)
=> new Parameter("JSESSIONID", token, ParameterType.Cookie);
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Atlassian.Jira;
using JiraTimeBot.Configuration;
using JiraTimeBot.TaskTime.Objects;
namespace JiraTimeBot.JiraIntegration
{
public interface IJiraApi
{
List<Issue> GetIssuesByJQL(string jql, Settings settings, DateTime? date = null, CancellationToken cancellationToken = default);
string GetTaskName(string branch, Settings settings);
List<Issue> GetWorkloggedIssuesByDate(Settings settings, DateTime? date = null, CancellationToken cancellationToken = default);
void SetTodayWorklog(List<TaskTimeItem> taskTimeItems, Settings settings, DateTime? date = null, bool dummy = false, bool addCommentsToWorklog = false, CancellationToken cancellationToken = default);
List<Worklog> GetManuallyWorklogged(List<TaskTimeItem> taskTimeItems, Settings settings, DateTime? date, CancellationToken cancellationToken = default);
}
}
+16 -13
View File
@@ -6,18 +6,11 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using JiraTimeBot.JiraIntegration.Authentificators;
using RestSharp.Authenticators;
namespace JiraTimeBot.JiraIntegration namespace JiraTimeBot.JiraIntegration
{ {
public interface IJiraApi
{
List<Issue> GetIssuesByJQL(string jql, Settings settings, DateTime? date = null, CancellationToken cancellationToken = default);
string GetTaskName(string branch, Settings settings);
List<Issue> GetWorkloggedIssuesByDate(Settings settings, DateTime? date = null, CancellationToken cancellationToken = default);
void SetTodayWorklog(List<TaskTimeItem> taskTimeItems, Settings settings, DateTime? date = null, bool dummy = false, bool addCommentsToWorklog = false, CancellationToken cancellationToken = default);
List<Worklog> GetManuallyWorklogged(List<TaskTimeItem> taskTimeItems, Settings settings, DateTime? date, CancellationToken cancellationToken = default);
}
public class JiraApi : IJiraApi public class JiraApi : IJiraApi
{ {
private readonly ILog _log; private readonly ILog _log;
@@ -31,9 +24,9 @@ namespace JiraTimeBot.JiraIntegration
public string GetTaskName(string branch, Settings settings) public string GetTaskName(string branch, Settings settings)
{ {
var jira = Jira.CreateRestClient(settings.JiraUrl, settings.JiraUserName, settings.JiraPassword);
try try
{ {
var jira = GetClient(settings);
var issue = jira.Issues.Queryable.FirstOrDefault(f => f.Key == branch); var issue = jira.Issues.Queryable.FirstOrDefault(f => f.Key == branch);
return issue?.Summary; return issue?.Summary;
} }
@@ -45,7 +38,7 @@ namespace JiraTimeBot.JiraIntegration
public List<Issue> GetIssuesByJQL(string jql, Settings settings, DateTime? date = null, CancellationToken cancellationToken = default) public List<Issue> GetIssuesByJQL(string jql, Settings settings, DateTime? date = null, CancellationToken cancellationToken = default)
{ {
var jira = Jira.CreateRestClient(settings.JiraUrl, settings.JiraUserName, settings.JiraPassword); var jira = GetClient(settings);
date = date.GetValueOrDefault(DateTime.Now.Date); date = date.GetValueOrDefault(DateTime.Now.Date);
var userName = settings.JiraUserName; var userName = settings.JiraUserName;
@@ -127,8 +120,8 @@ namespace JiraTimeBot.JiraIntegration
public void SetTodayWorklog(List<TaskTimeItem> taskTimeItems, Settings settings, DateTime? date = null, bool dummy = false, bool addCommentsToWorklog = false, CancellationToken cancellationToken = default) public void SetTodayWorklog(List<TaskTimeItem> taskTimeItems, Settings settings, DateTime? date = null, bool dummy = false, bool addCommentsToWorklog = false, CancellationToken cancellationToken = default)
{ {
date = date.GetValueOrDefault(DateTime.Now.Date).Date; date = date.GetValueOrDefault(DateTime.Now.Date).Date;
var jira = Jira.CreateRestClient(settings.JiraUrl, settings.JiraUserName, settings.JiraPassword); var jira = GetClient(settings);
if (settings.RemoveManuallyAddedWorklogs) if (settings.RemoveManuallyAddedWorklogs)
{ {
//Удаляем добавленные вручную пользователем данные. //Удаляем добавленные вручную пользователем данные.
@@ -219,5 +212,15 @@ namespace JiraTimeBot.JiraIntegration
} }
} }
} }
public Jira GetClient(Settings settings)
{
var jira = Jira.CreateRestClient(settings.JiraUrl, settings.JiraUserName, settings.JiraPassword);
if (settings.JiraPassword.Length == 32)
{
jira.RestClient.RestSharpClient.Authenticator = new JSessionAuthenticator(settings.JiraPassword);
}
return jira;
}
} }
} }
+233 -217
View File
@@ -1,218 +1,234 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.2.0.306\build\net46\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.2.0.306\build\net46\LibGit2Sharp.NativeBinaries.props')" /> <Import Project="..\packages\LibGit2Sharp.NativeBinaries.2.0.306\build\net46\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.2.0.306\build\net46\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F3B89316-C38C-4CE6-9D88-0B1373CFBA1A}</ProjectGuid> <ProjectGuid>{F3B89316-C38C-4CE6-9D88-0B1373CFBA1A}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>JiraTimeBot</RootNamespace> <RootNamespace>JiraTimeBot</RootNamespace>
<AssemblyName>JiraTimeBot</AssemblyName> <AssemblyName>JiraTimeBot</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled> <UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode> <UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval> <UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits> <UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically> <UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<LangVersion>7.1</LangVersion> <LangVersion>7.1</LangVersion>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>app.ico</ApplicationIcon> <ApplicationIcon>app.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject>JiraTimeBot.Program</StartupObject> <StartupObject>JiraTimeBot.Program</StartupObject>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Atlassian.Jira, Version=12.1.1.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Atlassian.Jira, Version=12.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Atlassian.SDK.12.1.1\lib\net452\Atlassian.Jira.dll</HintPath> <HintPath>..\packages\Atlassian.SDK.12.4.0\lib\net452\Atlassian.Jira.dll</HintPath>
</Reference> </Reference>
<Reference Include="Autofac, Version=5.1.2.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL"> <Reference Include="Autofac, Version=6.2.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\packages\Autofac.5.1.2\lib\net461\Autofac.dll</HintPath> <HintPath>..\packages\Autofac.6.2.0\lib\netstandard2.0\Autofac.dll</HintPath>
</Reference> </Reference>
<Reference Include="Autofac.Extras.AggregateService, Version=5.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL"> <Reference Include="Autofac.Extras.AggregateService, Version=6.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\packages\Autofac.Extras.AggregateService.5.0.0\lib\netstandard2.0\Autofac.Extras.AggregateService.dll</HintPath> <HintPath>..\packages\Autofac.Extras.AggregateService.6.0.0\lib\netstandard2.0\Autofac.Extras.AggregateService.dll</HintPath>
</Reference> </Reference>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL"> <Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath> <HintPath>..\packages\Castle.Core.4.4.1\lib\net45\Castle.Core.dll</HintPath>
</Reference> </Reference>
<Reference Include="LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL"> <Reference Include="LibGit2Sharp, Version=0.26.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<HintPath>..\packages\LibGit2Sharp.0.26.2\lib\net46\LibGit2Sharp.dll</HintPath> <HintPath>..\packages\LibGit2Sharp.0.26.2\lib\net46\LibGit2Sharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="Mercurial.Net, Version=1.1.1.607, Culture=neutral, PublicKeyToken=9e2fabf3af85dba9, processorArchitecture=MSIL"> <Reference Include="Mercurial.Net, Version=1.1.1.607, Culture=neutral, PublicKeyToken=9e2fabf3af85dba9, processorArchitecture=MSIL">
<HintPath>..\packages\Mercurial.Net.1.1.1.607\lib\net35-Client\Mercurial.Net.dll</HintPath> <HintPath>..\packages\Mercurial.Net.1.1.1.607\lib\net35-Client\Mercurial.Net.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath> <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="RestSharp, Version=106.0.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL"> <Reference Include="RestSharp, Version=106.11.7.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.106.10.1\lib\net452\RestSharp.dll</HintPath> <HintPath>..\packages\RestSharp.106.11.7\lib\net452\RestSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" /> <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<Reference Include="System.Configuration" /> <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
<Reference Include="System.Core" /> </Reference>
<Reference Include="System.DirectoryServices" /> <Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.IO.Compression" /> <Reference Include="System.Configuration" />
<Reference Include="System.IO.Compression.FileSystem" /> <Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath> <HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.7.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.DirectoryServices" />
<Reference Include="System.Security" /> <Reference Include="System.IO.Compression" />
<Reference Include="System.ServiceModel" /> <Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath> <HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Transactions" /> <Reference Include="System.Numerics" />
<Reference Include="System.Web" /> <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Reference Include="System.Xml.Linq" /> <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
<Reference Include="System.Data.DataSetExtensions" /> </Reference>
<Reference Include="Microsoft.CSharp" /> <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Reference Include="System.Data" /> <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Deployment" /> </Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Net.Http" /> <Reference Include="System.Security" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.ServiceModel" />
<Reference Include="System.Xml" /> <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
</ItemGroup> <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
<ItemGroup> </Reference>
<Compile Include="DI\ContainerBuilder.cs" /> <Reference Include="System.Transactions" />
<Compile Include="JiraIntegration\Comments\IJiraDescriptionSource.cs" /> <Reference Include="System.Web" />
<Compile Include="JiraIntegration\Comments\JiraDescriptionSource.cs" /> <Reference Include="System.Xml.Linq" />
<Compile Include="JiraIntegration\JiraHistory.cs" /> <Reference Include="System.Data.DataSetExtensions" />
<Compile Include="Job.cs" /> <Reference Include="Microsoft.CSharp" />
<Compile Include="Logger.cs" /> <Reference Include="System.Data" />
<Compile Include="Configuration\Settings.cs" /> <Reference Include="System.Deployment" />
<Compile Include="RepositoryProviders\JiraCommitEmulator.cs" /> <Reference Include="System.Drawing" />
<Compile Include="RepositoryProviders\GitLog.cs" /> <Reference Include="System.Net.Http" />
<Compile Include="RepositoryProviders\Interfaces\IAllVcsProviders.cs" /> <Reference Include="System.Windows.Forms" />
<Compile Include="RepositoryProviders\Modifiers\ITechnicalInfoSkipper.cs" /> <Reference Include="System.Xml" />
<Compile Include="RepositoryProviders\Modifiers\CommitSkipper.cs" /> </ItemGroup>
<Compile Include="RepositoryProviders\Modifiers\ICommitSkipper.cs" /> <ItemGroup>
<Compile Include="RepositoryProviders\Interfaces\IRepositoryLog.cs" /> <Compile Include="DI\ContainerBuilder.cs" />
<Compile Include="RepositoryProviders\Modifiers\TechnicalInfoSkipper.cs" /> <Compile Include="JiraIntegration\Authentificators\JSessionAuthenticator.cs" />
<Compile Include="TasksProcessors\IAllTasksProcessors.cs" /> <Compile Include="JiraIntegration\Comments\IJiraDescriptionSource.cs" />
<Compile Include="TaskTime\Objects\CommitType.cs" /> <Compile Include="JiraIntegration\Comments\JiraDescriptionSource.cs" />
<Compile Include="TaskTime\TaskTimeSpread.cs" /> <Compile Include="JiraIntegration\IJiraApi.cs" />
<Compile Include="UI\frmMain.cs"> <Compile Include="JiraIntegration\JiraHistory.cs" />
<SubType>Form</SubType> <Compile Include="Job.cs" />
</Compile> <Compile Include="Logger.cs" />
<Compile Include="UI\frmMain.Designer.cs"> <Compile Include="Configuration\Settings.cs" />
<DependentUpon>frmMain.cs</DependentUpon> <Compile Include="RepositoryProviders\JiraCommitEmulator.cs" />
</Compile> <Compile Include="RepositoryProviders\GitLog.cs" />
<Compile Include="JiraIntegration\JiraApi.cs" /> <Compile Include="RepositoryProviders\Interfaces\IAllVcsProviders.cs" />
<Compile Include="RepositoryProviders\MercurialLog.cs" /> <Compile Include="RepositoryProviders\Modifiers\ITechnicalInfoSkipper.cs" />
<Compile Include="Configuration\PasswordEncryptionClass.cs" /> <Compile Include="RepositoryProviders\Modifiers\CommitSkipper.cs" />
<Compile Include="Program.cs" /> <Compile Include="RepositoryProviders\Modifiers\ICommitSkipper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="RepositoryProviders\Interfaces\IRepositoryLog.cs" />
<Compile Include="TasksProcessors\ITasksProcessor.cs" /> <Compile Include="RepositoryProviders\Modifiers\TechnicalInfoSkipper.cs" />
<Compile Include="TasksProcessors\MeetingProcessor.cs" /> <Compile Include="TasksProcessors\IAllTasksProcessors.cs" />
<Compile Include="TasksProcessors\WorkLogTasksProcessor.cs" /> <Compile Include="TaskTime\Objects\CommitType.cs" />
<Compile Include="TaskTime\ITaskTimeCalculator.cs" /> <Compile Include="TaskTime\TaskTimeSpread.cs" />
<Compile Include="TaskTime\TaskTimeByCommitsCalculator.cs" /> <Compile Include="UI\frmMain.cs">
<Compile Include="TaskTime\Objects\TaskTimeItem.cs" /> <SubType>Form</SubType>
<Compile Include="UI\frmSettings.cs"> </Compile>
<SubType>Form</SubType> <Compile Include="UI\frmMain.Designer.cs">
</Compile> <DependentUpon>frmMain.cs</DependentUpon>
<Compile Include="UI\frmSettings.Designer.cs"> </Compile>
<DependentUpon>frmSettings.cs</DependentUpon> <Compile Include="JiraIntegration\JiraApi.cs" />
</Compile> <Compile Include="RepositoryProviders\MercurialLog.cs" />
<Compile Include="UI\Startup\AutoStartUp.cs" /> <Compile Include="Configuration\PasswordEncryptionClass.cs" />
<Compile Include="UI\Tray\SingleInstance.cs" /> <Compile Include="Program.cs" />
<Compile Include="UI\Tray\ITrayMenu.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI\Tray\RestoreFromTray.cs" /> <Compile Include="TasksProcessors\ITasksProcessor.cs" />
<Compile Include="UI\Tray\TrayMenu.cs" /> <Compile Include="TasksProcessors\MeetingProcessor.cs" />
<Compile Include="Update\GitHubDataObjects.cs" /> <Compile Include="TasksProcessors\WorkLogTasksProcessor.cs" />
<Compile Include="Update\IUpdater.cs" /> <Compile Include="TaskTime\ITaskTimeCalculator.cs" />
<Compile Include="Update\Updater.cs" /> <Compile Include="TaskTime\TaskTimeByCommitsCalculator.cs" />
<EmbeddedResource Include="UI\frmMain.resx"> <Compile Include="TaskTime\Objects\TaskTimeItem.cs" />
<DependentUpon>frmMain.cs</DependentUpon> <Compile Include="UI\frmSettings.cs">
</EmbeddedResource> <SubType>Form</SubType>
<EmbeddedResource Include="Properties\Resources.resx"> </Compile>
<Generator>ResXFileCodeGenerator</Generator> <Compile Include="UI\frmSettings.Designer.cs">
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <DependentUpon>frmSettings.cs</DependentUpon>
<SubType>Designer</SubType> </Compile>
</EmbeddedResource> <Compile Include="UI\Startup\AutoStartUp.cs" />
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="UI\Tray\SingleInstance.cs" />
<AutoGen>True</AutoGen> <Compile Include="UI\Tray\ITrayMenu.cs" />
<DependentUpon>Resources.resx</DependentUpon> <Compile Include="UI\Tray\RestoreFromTray.cs" />
<DesignTime>True</DesignTime> <Compile Include="UI\Tray\TrayMenu.cs" />
</Compile> <Compile Include="Update\GitHubDataObjects.cs" />
<EmbeddedResource Include="UI\frmSettings.resx"> <Compile Include="Update\IUpdater.cs" />
<DependentUpon>frmSettings.cs</DependentUpon> <Compile Include="Update\Updater.cs" />
</EmbeddedResource> <EmbeddedResource Include="UI\frmMain.resx">
<None Include="packages.config" /> <DependentUpon>frmMain.cs</DependentUpon>
<None Include="Properties\Settings.settings"> </EmbeddedResource>
<Generator>SettingsSingleFileGenerator</Generator> <EmbeddedResource Include="Properties\Resources.resx">
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <Generator>ResXFileCodeGenerator</Generator>
</None> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
<Compile Include="Properties\Settings.Designer.cs"> <SubType>Designer</SubType>
<AutoGen>True</AutoGen> </EmbeddedResource>
<DependentUpon>Settings.settings</DependentUpon> <Compile Include="Properties\Resources.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput> <AutoGen>True</AutoGen>
</Compile> <DependentUpon>Resources.resx</DependentUpon>
</ItemGroup> <DesignTime>True</DesignTime>
<ItemGroup> </Compile>
<None Include="App.config" /> <EmbeddedResource Include="UI\frmSettings.resx">
</ItemGroup> <DependentUpon>frmSettings.cs</DependentUpon>
<ItemGroup> </EmbeddedResource>
<Content Include="app.ico" /> <None Include="packages.config" />
</ItemGroup> <None Include="Properties\Settings.settings">
<ItemGroup> <Generator>SettingsSingleFileGenerator</Generator>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1"> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
<Visible>False</Visible> </None>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName> <Compile Include="Properties\Settings.Designer.cs">
<Install>true</Install> <AutoGen>True</AutoGen>
</BootstrapperPackage> <DependentUpon>Settings.settings</DependentUpon>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> <DesignTimeSharedInput>True</DesignTimeSharedInput>
<Visible>False</Visible> </Compile>
<ProductName>.NET Framework 3.5 SP1</ProductName> </ItemGroup>
<Install>false</Install> <ItemGroup>
</BootstrapperPackage> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ItemGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Content Include="app.ico" />
<PropertyGroup> </ItemGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> <ItemGroup>
</PropertyGroup> <BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.2.0.306\build\net46\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.2.0.306\build\net46\LibGit2Sharp.NativeBinaries.props'))" /> <Visible>False</Visible>
</Target> <ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.2.0.306\build\net46\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.2.0.306\build\net46\LibGit2Sharp.NativeBinaries.props'))" />
</Target>
</Project> </Project>
+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 © 2020")] [assembly: AssemblyCopyright("Copyright © 2020")]
[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.89")] [assembly: AssemblyVersion("1.0.94")]
[assembly: AssemblyFileVersion("1.0.89")] [assembly: AssemblyFileVersion("1.0.94")]
[assembly: AssemblyInformationalVersion("1.0.89")] [assembly: AssemblyInformationalVersion("1.0.94")]
+11 -3
View File
@@ -114,7 +114,7 @@ namespace JiraTimeBot.RepositoryProviders
continue; continue;
} }
var regex = new Regex("[a-zA-Z0-9]{1,4}-[0-9]{1,6}"); var regex = new Regex("[a-zA-Z0-9]{1,5}-[0-9]{1,6}");
var branch = ListBranchesContainsCommit(repo, commit.Sha) var branch = ListBranchesContainsCommit(repo, commit.Sha)
.Select(f => f.FriendlyName) .Select(f => f.FriendlyName)
.FirstOrDefault(f => regex.IsMatch(f)); .FirstOrDefault(f => regex.IsMatch(f));
@@ -184,7 +184,7 @@ namespace JiraTimeBot.RepositoryProviders
bool directBranchHasBeenFound = false; bool directBranchHasBeenFound = false;
foreach (var branch in repo.Branches) foreach (var branch in repo.Branches)
{ {
if (branch.Tip.Sha != commitSha) if (branch.Tip?.Sha != commitSha)
{ {
continue; continue;
} }
@@ -200,7 +200,15 @@ namespace JiraTimeBot.RepositoryProviders
foreach (var branch in repo.Branches) foreach (var branch in repo.Branches)
{ {
var commits = repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = branch }).Where(c => c.Sha == commitSha); List<Commit> commits = new List<Commit>();
try
{
commits = repo.Commits.QueryBy(new CommitFilter {IncludeReachableFrom = branch}).Where(c => c.Sha == commitSha).ToList();
}
catch (Exception)
{
continue;
}
if (!commits.Any()) if (!commits.Any())
{ {
+18 -14
View File
@@ -1,15 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Atlassian.SDK" version="12.1.1" targetFramework="net461" /> <package id="Atlassian.SDK" version="12.4.0" targetFramework="net461" />
<package id="Autofac" version="5.1.2" targetFramework="net461" /> <package id="Autofac" version="6.2.0" targetFramework="net461" />
<package id="Autofac.Extras.AggregateService" version="5.0.0" targetFramework="net461" /> <package id="Autofac.Extras.AggregateService" version="6.0.0" targetFramework="net461" />
<package id="Castle.Core" version="4.4.0" targetFramework="net461" /> <package id="Castle.Core" version="4.4.1" targetFramework="net461" />
<package id="LibGit2Sharp" version="0.26.2" targetFramework="net461" /> <package id="LibGit2Sharp" version="0.26.2" targetFramework="net461" />
<package id="LibGit2Sharp.NativeBinaries" version="2.0.306" targetFramework="net461" /> <package id="LibGit2Sharp.NativeBinaries" version="2.0.306" targetFramework="net461" />
<package id="Mercurial.Net" version="1.1.1.607" targetFramework="net461" /> <package id="Mercurial.Net" version="1.1.1.607" targetFramework="net461" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.0" targetFramework="net461" /> <package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" /> <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
<package id="RestSharp" version="106.10.1" targetFramework="net461" /> <package id="RestSharp" version="106.11.7" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net461" /> <package id="System.Buffers" version="4.5.1" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" /> <package id="System.Diagnostics.DiagnosticSource" version="4.7.1" targetFramework="net461" />
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" />
</packages> </packages>