Skip to content

Commit

Permalink
Add VS2022 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Samir L. Boulema committed Jul 29, 2021
1 parent 41c8e7f commit 6746a97
Show file tree
Hide file tree
Showing 79 changed files with 1,729 additions and 1,953 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# VSTHRD200: Use "Async" suffix for async methods
dotnet_diagnostic.VSTHRD200.severity = none
5 changes: 3 additions & 2 deletions TGIT.sln
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28210.120
# Visual Studio Version 17
VisualStudioVersion = 17.0.31423.177
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6D6C80BD-B63E-4F6D-A9D3-89AE15DA2D7C}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
azure-pipelines.yml = azure-pipelines.yml
publish-manifest.json = publish-manifest.json
README.md = README.md
Expand Down
19 changes: 19 additions & 0 deletions TGit/Commands/Context/AddFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using System.ComponentModel.Design;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.AddContext)]
internal sealed class AddFileCommand : BaseCommand<AddFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();

await ProcessHelper.RunTortoiseGitFileCommand(Package, "add");
}
}
}
19 changes: 19 additions & 0 deletions TGit/Commands/Context/BlameFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using System.ComponentModel.Design;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.BlameContext)]
internal sealed class BlameFileCommand : BaseCommand<BlameFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();

await ProcessHelper.RunTortoiseGitFileCommand(Package, "blame", $"/line:{await FileHelper.GetActiveDocumentCurrentLine()}");
}
}
}
28 changes: 28 additions & 0 deletions TGit/Commands/Context/CommitFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Community.VisualStudio.Toolkit;
using EnvDTE;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using System.ComponentModel.Design;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.CommitContext)]
internal sealed class CommitFileCommand : BaseCommand<CommitFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();

var options = (OptionPageGrid)Package.GetDialogPage(typeof(OptionPageGrid));
var commitMessage = await GitHelper.GetCommitMessage(options.CommitMessage);
var bugId = await GitHelper.GetCommitMessage(options.BugId);
var gitConfig = await GitHelper.GetGitConfig();

var args = $"{(string.IsNullOrEmpty(commitMessage) ? string.Empty : $"/logmsg:\"{commitMessage}\"")} " +
$"{(!string.IsNullOrEmpty(bugId) && !string.IsNullOrEmpty(gitConfig.BugTraqMessage) ? $"/bugid:\"{bugId}\"" : string.Empty)}";

await ProcessHelper.RunTortoiseGitFileCommand(Package, "commit", args);
}
}
}
16 changes: 16 additions & 0 deletions TGit/Commands/Context/DeleteFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.DeleteContext)]
internal sealed class DeleteFileCommand : BaseCommand<DeleteFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ProcessHelper.RunTortoiseGitFileCommand(Package, "remove");
}
}
}
16 changes: 16 additions & 0 deletions TGit/Commands/Context/DeleteKeepFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.DeleteKeepContext)]
internal sealed class DeleteKeepFileCommand : BaseCommand<DeleteKeepFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ProcessHelper.RunTortoiseGitFileCommand(Package, "remove", "/keep");
}
}
}
19 changes: 19 additions & 0 deletions TGit/Commands/Context/DiffFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using System.ComponentModel.Design;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.DiffContext)]
internal sealed class DiffFileCommand : BaseCommand<DiffFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();

await ProcessHelper.RunTortoiseGitFileCommand(Package, "diff");
}
}
}
16 changes: 16 additions & 0 deletions TGit/Commands/Context/DiskBrowserFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.DiskBrowserContext)]
internal sealed class DiskBrowserFileCommand : BaseCommand<DiskBrowserFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
ProcessHelper.Start(await FileHelper.GetActiveDocumentFilePath());
}
}
}
19 changes: 19 additions & 0 deletions TGit/Commands/Context/FetchFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using System.ComponentModel.Design;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.FetchContext)]
internal sealed class FetchFileCommand : BaseCommand<FetchFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();

await ProcessHelper.RunTortoiseGitFileCommand(Package, "fetch");
}
}
}
19 changes: 19 additions & 0 deletions TGit/Commands/Context/MergeFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using System.ComponentModel.Design;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.MergeContext)]
internal sealed class MergeFileCommand : BaseCommand<MergeFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();

await ProcessHelper.RunTortoiseGitFileCommand(Package, "merge");
}
}
}
31 changes: 31 additions & 0 deletions TGit/Commands/Context/PrefDiffFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using System.ComponentModel.Design;
using System.IO;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.PrefDiffContext)]
internal sealed class PrefDiffFileCommand : BaseCommand<PrefDiffFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();

var filePath = await FileHelper.GetActiveDocumentFilePath();
var exactFilePath = FileHelper.GetExactFileName(filePath);

var revisions = await ProcessHelper.GitResult(Path.GetDirectoryName(filePath), $"log -2 --pretty=format:%h {exactFilePath}");

if (!revisions.Contains(","))
{
await VS.MessageBox.ShowErrorAsync("Could not determine the last committed revision!");
return;
}

await ProcessHelper.RunTortoiseGitFileCommand(Package, "diff", $"/startrev:{revisions.Split(',')[0]} /endrev:{revisions.Split(',')[1]}", exactFilePath);
}
}
}
19 changes: 19 additions & 0 deletions TGit/Commands/Context/PullFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using System.ComponentModel.Design;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.PullContext)]
internal sealed class PullFileCommand : BaseCommand<PullFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();

await ProcessHelper.RunTortoiseGitFileCommand(Package, "pull");
}
}
}
16 changes: 16 additions & 0 deletions TGit/Commands/Context/RepoBrowserFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.RepoBrowserContext)]
internal sealed class RepoBrowserFileCommand : BaseCommand<RepoBrowserFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ProcessHelper.RunTortoiseGitFileCommand(Package, "repobrowser");
}
}
}
16 changes: 16 additions & 0 deletions TGit/Commands/Context/RevGraphFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.RevGraphContext)]
internal sealed class RevGraphFileCommand : BaseCommand<RevGraphFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ProcessHelper.RunTortoiseGitFileCommand(Package, "revisiongraph");
}
}
}
19 changes: 19 additions & 0 deletions TGit/Commands/Context/RevertFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using System.ComponentModel.Design;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.RevertContext)]
internal sealed class RevertFileCommand : BaseCommand<RevertFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();

await ProcessHelper.RunTortoiseGitFileCommand(Package, "revert");
}
}
}
16 changes: 16 additions & 0 deletions TGit/Commands/Context/ShowLogFileCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Community.VisualStudio.Toolkit;
using Microsoft.VisualStudio.Shell;
using SamirBoulema.TGit.Helpers;
using Task = System.Threading.Tasks.Task;

namespace SamirBoulema.TGit.Commands
{
[Command(GuidList.GuidTgitCmdSetString, PkgCmdIDList.ShowLogContext)]
internal sealed class ShowLogFileCommand : BaseCommand<ShowLogFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ProcessHelper.RunTortoiseGitFileCommand(Package, "log");
}
}
}
Loading

0 comments on commit 6746a97

Please sign in to comment.