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

Commit e0eeacf

Browse files
author
Dan Schulte
committed
Changes based on PR feedback
1 parent 348122a commit e0eeacf

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,35 @@ public void ShowHomePage()
6767

6868
public void ShowPublishSection()
6969
{
70-
#if TEAMEXPLORER14 || TEAMEXPLORER15
70+
#if TEAMEXPLORER16
71+
// Only call InitializeOrPushRepositoryToGitService when IGitActionsExt2 exists
72+
if (FindIGitActionsExt2() is object)
73+
{
74+
InitializeOrPushRepositoryToGitService();
75+
return;
76+
}
77+
#endif
78+
7179
var te = serviceProvider.TryGetService<ITeamExplorer>();
7280
var page = te.NavigateToPage(new Guid(TeamExplorerPageIds.GitCommits), null);
7381
var publish = page?.GetSection(new Guid(GitHubPublishSection.GitHubPublishSectionId)) as GitHubPublishSection;
7482
publish?.Connect();
75-
#else
83+
}
84+
85+
#if TEAMEXPLORER16
86+
private static Type FindIGitActionsExt2()
87+
{
88+
Type type = typeof(IGitActionsExt);
89+
string name = $"{type.FullName}2";
90+
return type.Assembly.GetType(name, false);
91+
}
92+
93+
private void InitializeOrPushRepositoryToGitService()
94+
{
7695
IGitActionsExt2 gitActionsExt = serviceProvider.TryGetService<IGitActionsExt2>();
7796
gitActionsExt?.InitializeOrPushRepositoryToGitService();
78-
#endif
7997
}
98+
#endif
8099

81100
public async Task ShowRepositorySettingsRemotesAsync()
82101
{

0 commit comments

Comments
 (0)