Skip to content

Commit

Permalink
#71, #72
Browse files Browse the repository at this point in the history
  • Loading branch information
Samir L. Boulema committed Aug 10, 2021
1 parent 0d875b7 commit 30cdee9
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 36 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ dotnet_diagnostic.IDE0022.severity = none

# IDE0008: Use explicit type
dotnet_diagnostic.IDE0008.severity = none

# VSTHRD111: Use ConfigureAwait(bool)
dotnet_diagnostic.VSTHRD111.severity = none
1 change: 1 addition & 0 deletions TSVN.Shared/Commands/AddFileCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal sealed class AddFileCommand : BaseCommand<AddFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();
await CommandHelper.RunTortoiseSvnFileCommand("add");
}
Expand Down
5 changes: 3 additions & 2 deletions TSVN.Shared/Commands/CommitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ internal sealed class CommitCommand : BaseCommand<CommitCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await KnownCommands.File_SaveAll.ExecuteAsync().ConfigureAwait(false);
await CommandHelper.RunTortoiseSvnCommand("commit").ConfigureAwait(false);
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
await KnownCommands.File_SaveAll.ExecuteAsync();
await CommandHelper.RunTortoiseSvnCommand("commit");
}
}
}
1 change: 1 addition & 0 deletions TSVN.Shared/Commands/CommitFileCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal sealed class CommitFileCommand : BaseCommand<CommitFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();
await CommandHelper.RunTortoiseSvnFileCommand("commit");
}
Expand Down
1 change: 1 addition & 0 deletions TSVN.Shared/Commands/RenameFileCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal sealed class RenameFileCommand : BaseCommand<RenameFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
await KnownCommands.File_SaveAll.ExecuteAsync();
await CommandHelper.RunTortoiseSvnFileCommand("rename");
}
Expand Down
1 change: 1 addition & 0 deletions TSVN.Shared/Commands/UpdateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal sealed class UpdateCommand : BaseCommand<UpdateCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
await KnownCommands.File_SaveAll.ExecuteAsync();
await CommandHelper.RunTortoiseSvnCommand("update");
}
Expand Down
1 change: 1 addition & 0 deletions TSVN.Shared/Commands/UpdateFileCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal sealed class UpdateFileCommand : BaseCommand<UpdateFileCommand>
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();
await CommandHelper.RunTortoiseSvnFileCommand("update");
}
Expand Down
1 change: 1 addition & 0 deletions TSVN.Shared/Commands/UpdateToRevisionCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal sealed class UpdateToRevisionCommand : BaseCommand<UpdateToRevisionComm
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
await KnownCommands.File_SaveAll.ExecuteAsync();
await CommandHelper.RunTortoiseSvnCommand("update", "/rev");
}
Expand Down
1 change: 1 addition & 0 deletions TSVN.Shared/Commands/UpdateToRevisionFileCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal sealed class UpdateToRevisionFileCommand : BaseCommand<UpdateToRevision
{
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
await KnownCommands.File_SaveSelectedItems.ExecuteAsync();
await CommandHelper.RunTortoiseSvnFileCommand("update", "/rev");
}
Expand Down
4 changes: 2 additions & 2 deletions TSVN.Shared/Helpers/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static async Task OpenFile(string filePath)
return;
}

await VS.Commands.ExecuteAsync("File.OpenFile", filePath).ConfigureAwait(false);
await VS.Commands.ExecuteAsync("File.OpenFile", filePath);
}

/// <summary>
Expand All @@ -60,7 +60,7 @@ public static async Task<string> GetPath()
}

// Context menu in the Code Editor
var documentView = await VS.Documents.GetActiveDocumentViewAsync().ConfigureAwait(false);
var documentView = await VS.Documents.GetActiveDocumentViewAsync();
return documentView?.Document?.FilePath;
}

Expand Down
8 changes: 4 additions & 4 deletions TSVN.Shared/Options/OptionsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ private void OptionsDialog_Load(object sender, EventArgs e)

private async Task LoadDialog()
{
var solution = await VS.Solutions.GetCurrentSolutionAsync().ConfigureAwait(false);
var solution = await VS.Solutions.GetCurrentSolutionAsync();
var solutionFilePath = solution?.FullPath;

if (File.Exists(solutionFilePath))
{
options = await OptionsHelper.GetOptions().ConfigureAwait(false);
options = await OptionsHelper.GetOptions();
rootFolderTextBox.Text = options.RootFolder;
onItemAddedAddToSVNCheckBox.Checked = options.OnItemAddedAddToSVN;
onItemRenamedRenameInSVNCheckBox.Checked = options.OnItemRenamedRenameInSVN;
Expand All @@ -52,7 +52,7 @@ private async Task LoadDialog()

if (string.IsNullOrEmpty(rootFolderTextBox.Text))
{
rootFolderTextBox.Text = await CommandHelper.GetRepositoryRoot().ConfigureAwait(false);
rootFolderTextBox.Text = await CommandHelper.GetRepositoryRoot();
}
}

Expand All @@ -71,7 +71,7 @@ private async Task Save()
options.OnItemRenamedRenameInSVN = onItemRenamedRenameInSVNCheckBox.Checked;
options.OnItemRemovedRemoveFromSVN = onItemRemovedRemoveFromSVNCheckBox.Checked;
options.CloseOnEnd = closeOnEndCheckBox.Checked;
await OptionsHelper.SaveOptions(options).ConfigureAwait(false);
await OptionsHelper.SaveOptions(options);
Close();
}

Expand Down
2 changes: 1 addition & 1 deletion TSVN.Shared/Options/OptionsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static async Task SaveOptions(Options options)
{
var json = JsonConvert.SerializeObject(options);

var solution = await VS.Solutions.GetCurrentSolutionAsync().ConfigureAwait(false);
var solution = await VS.Solutions.GetCurrentSolutionAsync();
var solutionFilePath = solution?.FullPath;

if (!File.Exists(solutionFilePath))
Expand Down
12 changes: 6 additions & 6 deletions TSVN.Shared/TSVNPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
#region Events
private async Task ProjectItemsEvents_ItemRenamedAsync(string[] oldFilePaths, string[] newFilePaths)
{
var options = await OptionsHelper.GetOptions().ConfigureAwait(false);
var options = await OptionsHelper.GetOptions();

if (!options.OnItemRenamedRenameInSVN)
{
Expand All @@ -93,13 +93,13 @@ private async Task ProjectItemsEvents_ItemRenamedAsync(string[] oldFilePaths, st
File.Move(newFilePaths[i], oldFilePaths[i]);

// So that we can svn rename it properly
await CommandHelper.StartProcess(FileHelper.GetSvnExec(), $"mv {oldFilePaths[i]} {newFilePaths[i]}").ConfigureAwait(false);
await CommandHelper.StartProcess(FileHelper.GetSvnExec(), $"mv {oldFilePaths[i]} {newFilePaths[i]}");
}
}

private async Task ProjectItemsEvents_ItemAdded_Async(string[] filePaths)
{
var options = await OptionsHelper.GetOptions().ConfigureAwait(false);
var options = await OptionsHelper.GetOptions();

if (!options.OnItemAddedAddToSVN)
{
Expand All @@ -108,13 +108,13 @@ private async Task ProjectItemsEvents_ItemAdded_Async(string[] filePaths)

foreach (var filePath in filePaths)
{
await CommandHelper.RunTortoiseSvnFileCommand("add", filePath: filePath).ConfigureAwait(false);
await CommandHelper.RunTortoiseSvnFileCommand("add", filePath: filePath);
}
}

private async Task ProjectItemsEvents_ItemRemoved_Async(string[] filePaths)
{
var options = await OptionsHelper.GetOptions().ConfigureAwait(false);
var options = await OptionsHelper.GetOptions();

if (!options.OnItemRemovedRemoveFromSVN)
{
Expand All @@ -123,7 +123,7 @@ private async Task ProjectItemsEvents_ItemRemoved_Async(string[] filePaths)

foreach (var filePath in filePaths)
{
await CommandHelper.RunTortoiseSvnFileCommand("remove", filePath: filePath).ConfigureAwait(false);
await CommandHelper.RunTortoiseSvnFileCommand("remove", filePath: filePath);
}
}

Expand Down
4 changes: 2 additions & 2 deletions TSVN.Shared/TSVNToolWindowControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ private static ImageSource ToImageSource(Icon icon)

private void RefreshButton_Click(object sender, RoutedEventArgs e) => Refresh().FireAndForget();

private async Task Refresh() => Update(await CommandHelper.GetPendingChanges(), await CommandHelper.GetRepositoryRoot().ConfigureAwait(false));
private async Task Refresh() => Update(await CommandHelper.GetPendingChanges(), await CommandHelper.GetRepositoryRoot());

private void HideUnversionedButton_OnChecked(object sender, RoutedEventArgs e) => ToggleUnversioned(true).FireAndForget();

Expand All @@ -267,7 +267,7 @@ private async Task ToggleUnversioned(bool hide)
{
Settings.Default.HideUnversioned = hide;
Settings.Default.Save();
Update(await CommandHelper.GetPendingChanges(), await CommandHelper.GetRepositoryRoot().ConfigureAwait(false));
Update(await CommandHelper.GetPendingChanges(), await CommandHelper.GetRepositoryRoot());
}

private void TreeView_Collapsed(object sender, RoutedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion TSVN.VS2019/TSVN.VS2019.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<Version>4.0.173</Version>
</PackageReference>
<PackageReference Include="Community.VisualStudio.Toolkit">
<Version>16.0.76.257-pre</Version>
<Version>15.0.76.257-pre</Version>
</PackageReference>
<PackageReference Include="Community.VisualStudio.VSCT">
<Version>16.0.29.6</Version>
Expand Down
12 changes: 0 additions & 12 deletions TSVN.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
azure-pipelines.yml = azure-pipelines.yml
publish-manifest.VS2017.json = publish-manifest.VS2017.json
publish-manifest.VS2019.json = publish-manifest.VS2019.json
publish-manifest.VS2022.json = publish-manifest.VS2022.json
README.md = README.md
Expand All @@ -19,13 +18,10 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "TSVN.Shared", "TSVN.Shared\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TSVN.VS2019", "TSVN.VS2019\TSVN.VS2019.csproj", "{1C161366-D879-43BB-AC85-D7F5C82B9880}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TSVN.VS2017", "TSVN.VS2017\TSVN.VS2017.csproj", "{8B7B2AB8-91B0-4CB2-87A0-EAE2A637C55E}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
TSVN.Shared\TSVN.Shared.projitems*{1c161366-d879-43bb-ac85-d7f5c82b9880}*SharedItemsImports = 4
TSVN.Shared\TSVN.Shared.projitems*{81ad421f-adcc-41fb-bd06-23a6cfeb1d65}*SharedItemsImports = 4
TSVN.Shared\TSVN.Shared.projitems*{8b7b2ab8-91b0-4cb2-87a0-eae2a637c55e}*SharedItemsImports = 4
TSVN.Shared\TSVN.Shared.projitems*{900c73f3-67f8-428d-84d6-a29d91d10cea}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -51,14 +47,6 @@ Global
{1C161366-D879-43BB-AC85-D7F5C82B9880}.Release|Any CPU.Build.0 = Release|Any CPU
{1C161366-D879-43BB-AC85-D7F5C82B9880}.Release|x86.ActiveCfg = Release|x86
{1C161366-D879-43BB-AC85-D7F5C82B9880}.Release|x86.Build.0 = Release|x86
{8B7B2AB8-91B0-4CB2-87A0-EAE2A637C55E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B7B2AB8-91B0-4CB2-87A0-EAE2A637C55E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B7B2AB8-91B0-4CB2-87A0-EAE2A637C55E}.Debug|x86.ActiveCfg = Debug|x86
{8B7B2AB8-91B0-4CB2-87A0-EAE2A637C55E}.Debug|x86.Build.0 = Debug|x86
{8B7B2AB8-91B0-4CB2-87A0-EAE2A637C55E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B7B2AB8-91B0-4CB2-87A0-EAE2A637C55E}.Release|Any CPU.Build.0 = Release|Any CPU
{8B7B2AB8-91B0-4CB2-87A0-EAE2A637C55E}.Release|x86.ActiveCfg = Release|x86
{8B7B2AB8-91B0-4CB2-87A0-EAE2A637C55E}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 0 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ steps:
FileVersionNumber: '$(Build.BuildNumber)'
InformationalVersion: '$(Build.BuildNumber)'

- task: VsixToolsUpdateVersion@1
displayName: 'Update Vsix Version (VS2017)'
inputs:
FileName: $(Build.SourcesDirectory)\TSVN.VS2017\source.extension.vsixmanifest
VersionNumber: '$(Build.BuildNumber)'

- task: VsixToolsUpdateVersion@1
displayName: 'Update Vsix Version (VS2019)'
inputs:
Expand Down

0 comments on commit 30cdee9

Please sign in to comment.