Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 2e5ffb0

Browse files
author
Andreia Gaita
authored
Merge branch 'master' into refactor/sdk-csproj
2 parents e5f8504 + 46e8212 commit 2e5ffb0

File tree

11 files changed

+43
-218
lines changed

11 files changed

+43
-218
lines changed

appveyor.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ test:
2424
categories:
2525
except:
2626
- Timings
27-
after_test:
28-
- ps: |
29-
choco install --no-progress opencover.portable codecov
30-
OpenCover.Console.exe --% "-target:nunit3-console.exe" "-targetargs: test\GitHub.Api.UnitTests\bin\Release\GitHub.Api.UnitTests.dll test\GitHub.App.UnitTests\bin\Release\GitHub.App.UnitTests.dll test\GitHub.Exports.Reactive.UnitTests\bin\Release\GitHub.Exports.Reactive.UnitTests.dll test\GitHub.Exports.UnitTests\bin\Release\GitHub.Exports.UnitTests.dll test\GitHub.Extensions.UnitTests\bin\Release\GitHub.Extensions.UnitTests.dll test\GitHub.InlineReviews.UnitTests\bin\Release\GitHub.InlineReviews.UnitTests.dll test\GitHub.Primitives.UnitTests\bin\Release\GitHub.Primitives.UnitTests.dll test\GitHub.TeamFoundation.UnitTests\bin\Release\GitHub.TeamFoundation.UnitTests.dll test\GitHub.UI.UnitTests\bin\Release\GitHub.UI.UnitTests.dll test\GitHub.VisualStudio.UnitTests\bin\Release\GitHub.VisualStudio.UnitTests.dll test\MetricsTests\MetricsTests\bin\Release\MetricsTests.dll test\TrackingCollectionTests\bin\Release\TrackingCollectionTests.dll --where cat!=Timings --inprocess --noresult" -filter:"+[GitHub*]* -[GitHub*UnitTests]*" -register:user -output:".\coverage.xml"
31-
codecov -f "coverage.xml"
3227
on_success:
3328
- ps: |
3429
if ($full_build) {

src/GitHub.InlineReviews/GitHub.InlineReviews.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@
160160
<None Include="packages.config">
161161
<SubType>Designer</SubType>
162162
</None>
163-
<None Include="source.extension.vsixmanifest">
164-
<SubType>Designer</SubType>
165-
</None>
166163
</ItemGroup>
167164
<ItemGroup>
168165
<ProjectReference Include="..\..\submodules\octokit.net\Octokit\Octokit.csproj">

src/GitHub.InlineReviews/source.extension.vsixmanifest

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/GitHub.StartPage/GitHub.StartPage.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@
7474
<None Include="packages.config">
7575
<SubType>Designer</SubType>
7676
</None>
77-
<None Include="source.extension.vsixmanifest">
78-
<SubType>Designer</SubType>
79-
</None>
8077
</ItemGroup>
8178
<ItemGroup>
8279
<ProjectReference Include="..\..\submodules\reactiveui\ReactiveUI\ReactiveUI_Net45.csproj">

src/GitHub.StartPage/source.extension.vsixmanifest

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/GitHub.TeamFoundation.14/RegistryHelper.cs

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.Globalization;
45
using System.IO;
56
using System.Linq;
@@ -14,50 +15,42 @@ namespace GitHub.TeamFoundation
1415
internal class RegistryHelper
1516
{
1617
static readonly ILogger log = LogManager.ForContext<RegistryHelper>();
17-
const string TEGitKey = @"Software\Microsoft\VisualStudio\14.0\TeamFoundation\GitSourceControl";
18+
1819
static RegistryKey OpenGitKey(string path)
1920
{
20-
return Microsoft.Win32.Registry.CurrentUser.OpenSubKey(TEGitKey + "\\" + path, true);
21+
var keyName = $"Software\\Microsoft\\VisualStudio\\{MajorVersion}.0\\TeamFoundation\\GitSourceControl\\{path}";
22+
return Registry.CurrentUser.OpenSubKey(keyName, true);
2123
}
2224

2325
internal static IEnumerable<ILocalRepositoryModel> PokeTheRegistryForRepositoryList()
2426
{
25-
var key = OpenGitKey("Repositories");
26-
27-
if (key != null)
27+
using (var key = OpenGitKey("Repositories"))
2828
{
29-
using (key)
29+
if (key == null)
3030
{
31-
return key.GetSubKeyNames().Select(x =>
32-
{
33-
var subkey = key.OpenSubKey(x);
31+
return Enumerable.Empty<ILocalRepositoryModel>();
32+
}
3433

35-
if (subkey != null)
34+
return key.GetSubKeyNames().Select(x =>
35+
{
36+
using (var subkey = key.OpenSubKey(x))
37+
{
38+
try
3639
{
37-
using (subkey)
38-
{
39-
try
40-
{
41-
var path = subkey?.GetValue("Path") as string;
42-
if (path != null && Directory.Exists(path))
43-
return new LocalRepositoryModel(path, GitService.GitServiceHelper);
44-
}
45-
catch (Exception)
46-
{
47-
// no sense spamming the log, the registry might have ton of stale things we don't care about
48-
}
49-
50-
}
40+
var path = subkey?.GetValue("Path") as string;
41+
if (path != null && Directory.Exists(path))
42+
return new LocalRepositoryModel(path, GitService.GitServiceHelper);
43+
}
44+
catch (Exception)
45+
{
46+
// no sense spamming the log, the registry might have ton of stale things we don't care about
5147
}
52-
5348
return null;
54-
})
55-
.Where(x => x != null)
56-
.ToList();
57-
}
49+
}
50+
})
51+
.Where(x => x != null)
52+
.ToList();
5853
}
59-
60-
return new ILocalRepositoryModel[0];
6154
}
6255

6356
internal static string PokeTheRegistryForLocalClonePath()
@@ -68,23 +61,24 @@ internal static string PokeTheRegistryForLocalClonePath()
6861
}
6962
}
7063

71-
const string NewProjectDialogKeyPath = @"Software\Microsoft\VisualStudio\14.0\NewProjectDialog";
7264
const string MRUKeyPath = "MRUSettingsLocalProjectLocationEntries";
7365
internal static string SetDefaultProjectPath(string path)
7466
{
67+
var newProjectDialogKeyPath = $"Software\\Microsoft\\VisualStudio\\{MajorVersion}.0\\NewProjectDialog";
68+
7569
var old = String.Empty;
7670
try
7771
{
78-
var newProjectKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(NewProjectDialogKeyPath, true) ??
79-
Microsoft.Win32.Registry.CurrentUser.CreateSubKey(NewProjectDialogKeyPath);
72+
var newProjectKey = Registry.CurrentUser.OpenSubKey(newProjectDialogKeyPath, true) ??
73+
Registry.CurrentUser.CreateSubKey(newProjectDialogKeyPath);
8074

8175
if (newProjectKey == null)
8276
{
8377
throw new GitHubLogicException(
8478
string.Format(
8579
CultureInfo.CurrentCulture,
8680
"Could not open or create registry key '{0}'",
87-
NewProjectDialogKeyPath));
81+
newProjectDialogKeyPath));
8882
}
8983

9084
using (newProjectKey)
@@ -132,5 +126,8 @@ internal static string SetDefaultProjectPath(string path)
132126
}
133127
return old;
134128
}
129+
130+
// Major version number of the current devenv process
131+
static int MajorVersion => Process.GetCurrentProcess().MainModule.FileVersionInfo.FileMajorPart;
135132
}
136133
}

src/GitHub.TeamFoundation.14/Services/VSGitServices.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if TEAMEXPLORER15
1+
#if !TEAMEXPLORER14
22
// Microsoft.VisualStudio.Shell.Framework has an alias to avoid conflict with IAsyncServiceProvider
33
extern alias SF15;
44
using ServiceProgressData = SF15::Microsoft.VisualStudio.Shell.ServiceProgressData;

src/GitHub.TeamFoundation.15/GitHub.TeamFoundation.15.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@
179179
<Compile Include="..\GitHub.TeamFoundation.14\Home\ForkNavigationItem.cs">
180180
<Link>Home\ForkNavigationItem.cs</Link>
181181
</Compile>
182+
<Compile Include="..\GitHub.TeamFoundation.14\RegistryHelper.cs">
183+
<Link>RegistryHelper.cs</Link>
184+
</Compile>
182185
<Compile Include="..\GitHub.TeamFoundation.14\Services\LocalRepositoryModelFactory.cs">
183186
<Link>Services\LocalRepositoryModelFactory.cs</Link>
184187
</Compile>
@@ -248,7 +251,6 @@
248251
<Compile Include="..\GitHub.TeamFoundation.14\Services\VSGitServices.cs">
249252
<Link>Services\VSGitServices.cs</Link>
250253
</Compile>
251-
<Compile Include="RegistryHelper.cs" />
252254
<Compile Include="..\common\SolutionInfo.cs">
253255
<Link>Properties\SolutionInfo.cs</Link>
254256
</Compile>

src/GitHub.TeamFoundation.15/RegistryHelper.cs

Lines changed: 0 additions & 124 deletions
This file was deleted.

src/GitHub.VisualStudio/Services/VSGitExtFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public IVSGitExt Create()
3030
case 14:
3131
return Create(() => new VSGitExt14(asyncServiceProvider));
3232
case 15:
33+
case 16:
3334
return Create(() => new VSGitExt15(asyncServiceProvider));
3435
default:
3536
log.Error("There is no IVSGitExt implementation for DTE version {Version}", vsVersion);

0 commit comments

Comments
 (0)