Skip to content

Commit 1d74527

Browse files
authored
feat: Update to support GitExtensions v5 (#87)
* update to .net8 * update following api changes
1 parent dc94c8a commit 1d74527

15 files changed

+60
-31
lines changed

Directory.Build.props

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<PropertyGroup>
1818
<UseWindowsForms>true</UseWindowsForms>
19-
<TargetFramework>net6.0-windows7.0</TargetFramework>
20-
<VersionPrefix>2.0.8</VersionPrefix>
19+
<TargetFramework>net8.0-windows7.0</TargetFramework>
20+
<VersionPrefix>3.0.0</VersionPrefix>
2121
</PropertyGroup>
2222
</Project>

Directory.Packages.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
66
</PropertyGroup>
77
<ItemGroup>
8-
<PackageVersion Include="GitExtensions.Extensibility" Version="0.3.1.66" />
8+
<PackageVersion Include="GitExtensions.Extensibility" Version="0.3.2.72" />
99
<PackageVersion Include="JetBrains.Annotations" Version="2023.2.0" />
1010
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
1111
<PackageVersion Include="Microsoft.VisualStudio.Composition" Version="17.2.41" />

GitExtensions.GerritPlugin.sln

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio Version 16
3-
VisualStudioVersion = 16.0.29709.97
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.11.35222.181
45
MinimumVisualStudioVersion = 15.0.26124.0
56
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitExtensions.GerritPlugin", "src\GitExtensions.GerritPlugin\GitExtensions.GerritPlugin.csproj", "{58C09A62-E18E-4B76-AADB-D0B176C5424E}"
67
EndProject
78
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitExtensions.GerritPlugin.Tests", "UnitTests\GitExtensions.GerritPlugin.Tests\GitExtensions.GerritPlugin.Tests.csproj", "{847B0590-A76F-4B90-B797-10165DD6705F}"
89
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{90CE3F9B-3847-44E5-A4C8-A850E8C3CA3A}"
11+
ProjectSection(SolutionItems) = preProject
12+
Directory.Build.props = Directory.Build.props
13+
Directory.Packages.props = Directory.Packages.props
14+
README.md = README.md
15+
EndProjectSection
16+
EndProject
917
Global
1018
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1119
Debug|Any CPU = Debug|Any CPU
@@ -25,7 +33,6 @@ Global
2533
HideSolutionNode = FALSE
2634
EndGlobalSection
2735
GlobalSection(ExtensibilityGlobals) = postSolution
28-
SolutionGuid = {464E76E6-53B0-4E56-B267-22F7F82476F1}
2936
SolutionGuid = {F41D2140-C196-4AA5-B8C2-23BC5BEA8D01}
3037
EndGlobalSection
3138
EndGlobal

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ Use the following pattern to link revision data to Gerrit:
3131
| 3.5.x < v <= 4.0.0 | 2.0.0 <= v <= 2.0.1 |
3232
| 4.0.1 <= v <= 4.0.2 | 2.0.5 |
3333
| 4.1.x <= v <= 4.2.0 | 2.0.6 <= v |
34-
| 4.2.x <= v | 2.0.7 <= v |
34+
| 4.2.x <= v <= 5.0.0 | 2.0.7 <= v |
35+
| 5.0.x <= v | 3.0.0 <= v |
3536

3637
## GitExtensions Plugin Template information
3738

3839
The [GitExtensions Plugin Template](https://github.com/gitextensions/gitextensions.plugintemplate) gives additional information about the plugin development.
40+
41+
## Development
42+
43+
/!\ GitExtensions version properties overwritten in [GitExtensions.GerritPlugin.csproj.user](./src/GitExtensions.GerritPlugin/GitExtensions.GerritPlugin.csproj.user) file.

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#---------------------------------#
44

55
# version format
6-
version: 2.0.8.{build}
6+
version: 3.0.0.{build}
77

88
# version suffix, if any (e.g. '-RC1', '-beta' otherwise '')
99
environment:

src/GitExtensions.GerritPlugin/FormGerritBase.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System;
2+
using GitCommands;
3+
using GitExtensions.Extensibility.Git;
24
using GitUI;
35
using GitUIPluginInterfaces;
46

@@ -8,7 +10,7 @@ public class FormGerritBase : GitExtensionsForm
810
{
911
protected GerritSettings Settings { get; private set; }
1012
protected readonly IGitUICommands UiCommands;
11-
protected IGitModule Module => UiCommands.GitModule;
13+
protected IGitModule Module => UiCommands.Module;
1214

1315
private FormGerritBase()
1416
: this(null)

src/GitExtensions.GerritPlugin/FormGerritDownload.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
using System.Threading.Tasks;
66
using System.Windows.Forms;
77
using GitCommands;
8-
using GitCommands.Git.Commands;
8+
using GitCommands.Git;
9+
using GitExtensions.Extensibility.Git;
910
using GitExtUtils.GitUI;
1011
using GitUI;
1112
using GitUIPluginInterfaces;
@@ -123,7 +124,7 @@ private async Task<bool> DownloadChangeAsync(IWin32Window owner)
123124

124125
var checkoutCommand = UiCommands.CreateRemoteCommand();
125126

126-
checkoutCommand.CommandText = GitCommandHelpers.BranchCmd(branchName, "FETCH_HEAD", true);
127+
checkoutCommand.CommandText = Commands.Branch(branchName, "FETCH_HEAD", true);
127128
checkoutCommand.Completed += (_, e) =>
128129
{
129130
if (e.IsError && e.Command.CommandText != null && e.Command.CommandText.Contains("already exists"))
@@ -141,7 +142,7 @@ private async Task<bool> DownloadChangeAsync(IWin32Window owner)
141142

142143
var resetCommand = UiCommands.CreateRemoteCommand();
143144

144-
resetCommand.CommandText = GitCommandHelpers.ResetCmd(ResetMode.Hard, "FETCH_HEAD");
145+
resetCommand.CommandText = Commands.Reset(ResetMode.Hard, "FETCH_HEAD");
145146

146147
if (!RunCommand(resetCommand, change))
147148
{

src/GitExtensions.GerritPlugin/FormGerritPublish.cs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
using GitUIPluginInterfaces;
1111
using JetBrains.Annotations;
1212
using ResourceManager;
13+
using GitExtensions.Extensibility.Git;
14+
using GitExtensions.Extensibility;
1315

1416
namespace GitExtensions.GerritPlugin
1517
{

src/GitExtensions.GerritPlugin/FormGitReview.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Windows.Forms;
55
using GitCommands;
6+
using GitExtensions.Extensibility.Git;
67
using GitUI;
78
using GitUIPluginInterfaces;
89
using JetBrains.Annotations;
@@ -34,13 +35,13 @@ public sealed partial class FormGitReview : GitExtensionsForm, IGitUICommandsSou
3435
defaultrebase=0");
3536

3637
private string _originalGitReviewFileContent = string.Empty;
37-
private IGitModule Module => UICommands.GitModule;
38+
private IGitModule Module => UICommands.Module;
3839
private string GitreviewPath => Path.Combine(Module.WorkingDir, ".gitreview");
3940

4041
[CanBeNull] public event EventHandler<GitUICommandsChangedEventArgs> UICommandsChanged;
4142

42-
private GitUICommands _uiCommands;
43-
public GitUICommands UICommands
43+
private IGitUICommands _uiCommands;
44+
public IGitUICommands UICommands
4445
{
4546
get => _uiCommands;
4647
set

src/GitExtensions.GerritPlugin/GerritPlugin.cs

+9-5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
using System.Linq;
77
using System.Threading.Tasks;
88
using System.Windows.Forms;
9+
using GitCommands;
10+
using GitExtensions.Extensibility.Git;
11+
using GitExtensions.Extensibility.Plugins;
12+
using GitExtensions.Extensibility.Settings;
913
using GitExtensions.GerritPlugin.Properties;
1014
using GitExtensions.GerritPlugin.Server;
1115
using GitUI;
@@ -66,7 +70,7 @@ public class GerritPlugin : GitPluginBase, IGitPluginForRepository
6670
public GerritPlugin() : base(true)
6771
{
6872
SetNameAndDescription("Gerrit Code Review");
69-
Translate();
73+
Translate(AppSettings.CurrentTranslation);
7074
Icon = Resources.IconGerrit;
7175
}
7276

@@ -349,14 +353,14 @@ private async Task InstallCommitMsgHookAsync()
349353
{
350354
await _mainForm.SwitchToMainThreadAsync();
351355

352-
var settings = GerritSettings.Load(_mainForm, _gitUiCommands.GitModule);
356+
var settings = GerritSettings.Load(_mainForm, _gitUiCommands.Module);
353357

354358
if (settings == null)
355359
{
356360
return;
357361
}
358362

359-
var commitMessageHookPath = GetCommitMessageHookPath(_gitUiCommands.GitModule);
363+
var commitMessageHookPath = GetCommitMessageHookPath(_gitUiCommands.Module);
360364
var hooksFolderPath = Path.GetDirectoryName(commitMessageHookPath);
361365
if (!Directory.Exists(hooksFolderPath))
362366
{
@@ -403,7 +407,7 @@ private async Task InstallCommitMsgHookAsync()
403407

404408
// Update the cache.
405409

406-
HasValidCommitMsgHook(_gitUiCommands.GitModule, true);
410+
HasValidCommitMsgHook(_gitUiCommands.Module, true);
407411
}
408412
}
409413

@@ -416,7 +420,7 @@ private async Task<string> DownloadFromScpAsync(GerritSettings settings)
416420

417421
string content = await GerritUtil.RunGerritCommandAsync(
418422
_mainForm,
419-
_gitUiCommands.GitModule,
423+
_gitUiCommands.Module,
420424
"scp -f hooks/commit-msg",
421425
settings.DefaultRemote,
422426
new byte[] { 0, 0, 0, 0, 0, 0, 0 }).ConfigureAwait(false);

src/GitExtensions.GerritPlugin/GerritSettings.cs

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using System.IO;
33
using System.Linq;
44
using System.Windows.Forms;
5+
using GitExtensions.Extensibility.Git;
6+
using GitExtensions.Extensibility.Translations;
57
using GitUIPluginInterfaces;
68
using JetBrains.Annotations;
79
using ResourceManager;

src/GitExtensions.GerritPlugin/GerritUtil.cs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Threading.Tasks;
66
using System.Windows.Forms;
77
using GitCommands;
8+
using GitExtensions.Extensibility.Git;
89
using GitExtUtils;
910
using GitUI.Infrastructure;
1011
using GitUIPluginInterfaces;

src/GitExtensions.GerritPlugin/GitExtensions.GerritPlugin.csproj

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<!--/!\ GitExtensions version properties overwritten in `.csproj.user` file-->
23
<PropertyGroup>
34
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
45
</PropertyGroup>
@@ -24,6 +25,9 @@
2425

2526
<!-- References to Git Extensions' DLLs -->
2627
<ItemGroup>
28+
<Reference Include="GitExtensions.Extensibility">
29+
<HintPath>$(GitExtensionsPath)\GitExtensions.Extensibility.dll</HintPath>
30+
</Reference>
2731
<Reference Include="GitCommands">
2832
<HintPath>$(GitExtensionsPath)\GitCommands.dll</HintPath>
2933
</Reference>
@@ -42,16 +46,16 @@
4246
</ItemGroup>
4347

4448
<ItemGroup>
45-
<None Include="..\..\README.md">
46-
<Pack>True</Pack>
47-
<PackagePath>\</PackagePath>
49+
<None Include="..\..\README.md">
50+
<Pack>True</Pack>
51+
<PackagePath>\</PackagePath>
4852
</None>
4953
<None Include="Resources\GerritDownload.png" />
5054
<None Include="Resources\GerritInstallHook.png" />
5155
<None Include="Resources\GerritPublish.png" />
52-
<None Include="Resources\IconGerrit.png">
53-
<Pack>True</Pack>
54-
<PackagePath>\</PackagePath>
56+
<None Include="Resources\IconGerrit.png">
57+
<Pack>True</Pack>
58+
<PackagePath>\</PackagePath>
5559
</None>
5660
</ItemGroup>
5761

src/GitExtensions.GerritPlugin/GitExtensions.GerritPlugin.csproj.user

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- path is relative to $(ProjectDir) -->
55
<GitExtensionsDownloadPath>..\..\..\gitextensions.shared</GitExtensionsDownloadPath>
66
<!-- 'latest' or 'v3.1' (= tag from GitHub releases) or 'v3.1.0.5877' (= build number from AppVeyor)-->
7-
<GitExtensionsReferenceVersion>v4.2</GitExtensionsReferenceVersion>
7+
<GitExtensionsReferenceVersion>latest</GitExtensionsReferenceVersion>
88
<!-- 'GitHub' or 'AppVeyor' -->
99
<GitExtensionsReferenceSource>GitHub</GitExtensionsReferenceSource>
1010
<!-- for local builds (no download) -->

src/GitExtensions.GerritPlugin/GitExtensions.GerritPlugin.nuspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
<group>
1414
<dependency id="GitExtensions.Extensibility" version="[0.3.0, 0.4.0)" />
1515
</group>
16-
<!-- To fix Warning NU5128 Add a dependency group for net6.0-windows7.0 to the nuspec -->
17-
<group targetFramework="net6.0-windows7.0">
16+
<!-- To fix Warning NU5128 Add a dependency group for net8.0-windows7.0 to the nuspec -->
17+
<group targetFramework="net8.0-windows7.0">
1818
<dependency id="GitExtensions.Extensibility" version="[0.3.0, 0.4.0)" />
1919
</group>
2020
</dependencies>
2121
</metadata>
2222
<files>
2323
<file src="..\..\LICENSE.md" target="\" />
24-
<file src="bin\$configuration$\net6.0-windows7.0\GitExtensions.GerritPlugin.dll" target="\lib\" />
24+
<file src="bin\$configuration$\net8.0-windows7.0\GitExtensions.GerritPlugin.dll" target="\lib\" />
2525
<file src="Resources\IconGerrit.png" target="\Resources\" />
2626
</files>
2727
</package>

0 commit comments

Comments
 (0)