Skip to content

Commit

Permalink
NET8
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Nov 16, 2023
1 parent a17b82d commit 305ae53
Show file tree
Hide file tree
Showing 21 changed files with 151 additions and 116 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ dotnet_diagnostic.SA1122.severity = suggestion
dotnet_diagnostic.SA1108.severity = silent
dotnet_diagnostic.SA1012.severity = error
dotnet_diagnostic.SA1500.severity = error
dotnet_diagnostic.SA1316.severity = error

[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/dotnet-core-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3.0.3
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.1.3
uses: microsoft/setup-msbuild@v1.3.1

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Analogy.LogViewer.GitHistory.UnitTests/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public void TestMethod1()
{
}
}
}
}
14 changes: 11 additions & 3 deletions Analogy.LogViewer.GitHistory.sln
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29926.136
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analogy.LogViewer.GitHistory", "Analogy.LogViewer.GitHistory\Analogy.LogViewer.GitHistory.csproj", "{7925158E-7934-43AD-B4D5-3E6FF3933F86}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Analogy.LogViewer.GitHistory.UnitTests", "Analogy.LogViewer.GitHistory.UnitTests\Analogy.LogViewer.GitHistory.UnitTests.csproj", "{91B1A27F-6A72-4C20-BED2-3BF441CB8B9D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analogy.LogViewer.GitHistory.UnitTests", "Analogy.LogViewer.GitHistory.UnitTests\Analogy.LogViewer.GitHistory.UnitTests.csproj", "{91B1A27F-6A72-4C20-BED2-3BF441CB8B9D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2876F45C-CF82-4509-91F4-1641ECC8FF9A}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
.github\workflows\dotnet-core-desktop.yml = .github\workflows\dotnet-core-desktop.yml
nuget.config = nuget.config
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
49 changes: 13 additions & 36 deletions Analogy.LogViewer.GitHistory/Analogy.LogViewer.GitHistory.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,31 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<TargetFrameworks>net8.0-windows;net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<VersionPrefix>6.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Authors>Lior Banai</Authors>
<Description>Extension for Analogy Log Viewer that shows Git Histroy in searchable UI</Description>
<Copyright>Lior Banai @ 2020-2023</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Lior Banai @ 2020-2024</Copyright>
<PackageProjectUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer.GitHistory</PackageProjectUrl>
<RepositoryUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer.GitHistory</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>Aligh with latest API</PackageReleaseNotes>
<PackageIcon>Analogy.GitHistoryBanner.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<VersionPrefix>5.0.3.1</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Company>Analogy.LogViewer</Company>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
</PropertyGroup>

<ItemGroup>

<PackageReference Include="Analogy.LogViewer.Interfaces" Version="5.0.3" />
<PackageReference Include="Analogy.LogViewer.Template" Version="5.0.3" />
<PackageReference Include="LibGit2Sharp" Version="0.26.2" />
<PackageReference Include="Microsoft.Build.Tasks.Git" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageReference Include="Analogy.LogViewer.Interfaces" Version="6.0.0.1" />
<PackageReference Include="Analogy.LogViewer.Template" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" />
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' or '$(TargetFramework)' == 'net471' ">
<PackageReference Include="PolySharp" Version="1.13.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<ItemGroup Condition=" '$(TargetFramework)' != 'net471' ">
<PackageReference Include="LibGit2Sharp" Version="0.28.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net471' ">
<PackageReference Include="LibGit2Sharp" Version="0.26.2" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
Expand Down
6 changes: 2 additions & 4 deletions Analogy.LogViewer.GitHistory/DataTypes/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
namespace Analogy.LogViewer.GitHistory.DataTypes
{
public enum GitOperationType
{
{
History,
Fetch,
Merge,
Pull,

}

}
}
8 changes: 4 additions & 4 deletions Analogy.LogViewer.GitHistory/GitActions/GitFetchAction.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System;
using Analogy.Interfaces;
using Analogy.Interfaces.DataTypes;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Analogy.Interfaces;
using Analogy.Interfaces.DataTypes;

namespace Analogy.LogViewer.GitHistory.GitActions
{
Expand All @@ -25,4 +25,4 @@ public class GitFetchAction : IAnalogyCustomAction
public AnalogyCustomActionType Type { get; } = AnalogyCustomActionType.BelongsToProvider;
public AnalogyToolTip? ToolTip { get; set; }
}
}
}
2 changes: 1 addition & 1 deletion Analogy.LogViewer.GitHistory/GitOperationsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public GitOperationsForm()
InitializeComponent();
}
}
}
}
13 changes: 6 additions & 7 deletions Analogy.LogViewer.GitHistory/GitPullUC.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using Analogy.LogViewer.GitHistory.Managers;
using LibGit2Sharp;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Analogy.LogViewer.GitHistory.Managers;
using LibGit2Sharp;

namespace Analogy.LogViewer.GitHistory
{
Expand Down Expand Up @@ -38,11 +38,10 @@ private void BtnOperation_Click(object sender, EventArgs e)
var remote = repo.Network.Remotes["origin"];
var refSpecs = remote.FetchRefSpecs.Select(x => x.Specification);
Commands.Fetch(repo, remote.Name, refSpecs, null, logMessage);


var trackingBranch = repo.Head.TrackedBranch;
var log = repo.Commits.QueryBy(new CommitFilter
{IncludeReachableFrom = trackingBranch.Tip.Id, ExcludeReachableFrom = repo.Head.Tip.Id});
{ IncludeReachableFrom = trackingBranch.Tip.Id, ExcludeReachableFrom = repo.Head.Tip.Id });

var count = log.Count(); //Counts the number of log entries

Expand Down Expand Up @@ -76,4 +75,4 @@ private void lstRepositores_SelectedValueChanged(object sender, EventArgs e)
}
}
}
}
}
4 changes: 2 additions & 2 deletions Analogy.LogViewer.GitHistory/GitRepositoriesSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private void btnBrowser_Click(object sender, EventArgs e)
{
using (FolderBrowserDialog folderDlg = new FolderBrowserDialog
{
ShowNewFolderButton = false
ShowNewFolderButton = false,
})
{
// Show the FolderBrowserDialog.
Expand All @@ -64,4 +64,4 @@ private void btnSave_Click(object sender, EventArgs e)
UserSettingsManager.UserSettings.Save();
}
}
}
}
31 changes: 12 additions & 19 deletions Analogy.LogViewer.GitHistory/GitRepositoryLoader.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using Analogy.Interfaces;
using Analogy.LogViewer.GitHistory.DataTypes;
using Analogy.LogViewer.Template.Managers;
using LibGit2Sharp;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using Analogy.LogViewer.GitHistory.DataTypes;
using Analogy.LogViewer.Template.Managers;
using Microsoft.Extensions.Logging;

namespace Analogy.LogViewer.GitHistory
{
Expand All @@ -26,10 +26,10 @@ public class GitRepositoryLoader : Template.OnlineDataProvider
private RepositorySetting RepositorySetting { get; }
private GitOperationType Operation { get; }
public override bool UseCustomColors { get; set; }
public override IEnumerable<(string originalHeader, string replacementHeader)> GetReplacementHeaders()
=> new List<(string originalHeader, string replacementHeader)> { ("Source", "Branch"), ("Module", "Local Path") };
public override IEnumerable<(string OriginalHeader, string ReplacementHeader)> GetReplacementHeaders()
=> new List<(string OriginalHeader, string ReplacementHeader)> { ("Source", "Branch"), ("Module", "Local Path") };

public override (Color backgroundColor, Color foregroundColor) GetColorForMessage(IAnalogyLogMessage logMessage)
public override (Color BackgroundColor, Color ForegroundColor) GetColorForMessage(IAnalogyLogMessage logMessage)
=> (Color.Empty, Color.Empty);
public GitRepositoryLoader(RepositorySetting rs, GitOperationType operation)
{
Expand All @@ -41,7 +41,6 @@ public GitRepositoryLoader(RepositorySetting rs, GitOperationType operation)
public override Task InitializeDataProvider(ILogger logger)
{
return base.InitializeDataProvider(logger);

}

public override Task StartReceiving()
Expand All @@ -66,17 +65,16 @@ public override Task StartReceiving()
}
catch (Exception e)
{
LogManager.Instance.LogError(e,$@"Error reading {RepositorySetting.RepositoryPath}: {e}", nameof(StartReceiving));
LogManager.Instance.LogError(e, $@"Error reading {RepositorySetting.RepositoryPath}: {e}", nameof(StartReceiving));
AnalogyLogMessage m = new AnalogyLogMessage
{
Date = DateTime.Now,
Module = RepositorySetting.RepositoryPath,
Text = $"Error: {e}",
Level = AnalogyLogLevel.Error,
Class = AnalogyLogClass.General
Class = AnalogyLogClass.General,
};
MessageReady(this, new AnalogyLogMessageArgs(m, "", "", Id));

}
return Task.CompletedTask;
}
Expand Down Expand Up @@ -118,7 +116,7 @@ private void GetGitHistory()
User = $"Committer: {c.Committer.Name} ({c.Committer.Email}). Author: {c.Author.Name} ({c.Author.Email})",
FileName = c.Id.Sha,
Level = (c.Committer.Name == c.Author.Name) ? AnalogyLogLevel.Information : AnalogyLogLevel.Warning,
Class = AnalogyLogClass.General
Class = AnalogyLogClass.General,
};
m.AddOrReplaceAdditionalProperty("Category", c.Tree.FirstOrDefault()?.Name);
MessageReady(this, new AnalogyLogMessageArgs(m, "", "", Id));
Expand All @@ -136,12 +134,11 @@ private void GetGitHistory()
User = $"Committer: {c.Committer.Name} ({c.Committer.Email}). Author: {c.Author.Name} ({c.Author.Email})",
FileName = c.Id.Sha,
Level = AnalogyLogLevel.Warning,
Class = AnalogyLogClass.General
Class = AnalogyLogClass.General,
};
m.AddOrReplaceAdditionalProperty("Category", "TAG");

MessageReady(this, new AnalogyLogMessageArgs(m, "", "", Id));

}
}
}
Expand All @@ -153,8 +150,6 @@ private void PerformGitFetch()
var remote = repo.Network.Remotes["origin"];
var refSpecs = remote.FetchRefSpecs.Select(x => x.Specification);
Commands.Fetch(repo, remote.Name, refSpecs, null, "");


var trackingBranch = repo.Head.TrackedBranch;
var commits = repo.Commits.QueryBy(new CommitFilter
{ IncludeReachableFrom = trackingBranch.Tip.Id, ExcludeReachableFrom = repo.Head.Tip.Id });
Expand All @@ -170,16 +165,14 @@ private void PerformGitFetch()
User = $"Committer: {c.Committer.Name} ({c.Committer.Email}). Author: {c.Author.Name} ({c.Author.Email})",
FileName = c.Id.Sha,
Level = AnalogyLogLevel.Information,
Class = AnalogyLogClass.General
Class = AnalogyLogClass.General,
};
m.AddOrReplaceAdditionalProperty("Category", c.Tree.FirstOrDefault()?.Name);

MessageReady(this, new AnalogyLogMessageArgs(m, "", "", Id));

}
}
}
public override Task StopReceiving() => Task.CompletedTask;

}
}
}
6 changes: 3 additions & 3 deletions Analogy.LogViewer.GitHistory/IAnalogy/DownloadInformation.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System;
using Analogy.LogViewer.Template;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.Versioning;
using System.Text;
using System.Threading.Tasks;
using Analogy.LogViewer.Template;

namespace Analogy.LogViewer.GitHistory.IAnalogy
{
Expand Down Expand Up @@ -34,4 +34,4 @@ public override string InstalledVersionNumber
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System;
using Analogy.Interfaces;
using Analogy.Interfaces.Factories;
using Analogy.LogViewer.GitHistory.GitActions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Analogy.Interfaces;
using Analogy.Interfaces.Factories;
using Analogy.LogViewer.GitHistory.GitActions;

namespace Analogy.LogViewer.GitHistory.IAnalogy
{
Expand All @@ -15,4 +15,4 @@ public class GitHistoryCustomActionsFactory
public string Title { get; } = "Git Operations";
public IEnumerable<IAnalogyCustomAction> Actions { get; } = new List<IAnalogyCustomAction> { new GitFetchAction() };
}
}
}
Loading

0 comments on commit 305ae53

Please sign in to comment.