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

Commit 0ca8b4d

Browse files
committed
Handle cloning the same in VS 2017 and 2019
Progress appears on Team Explorer - Home and Output > Source Control - Git. No need to also display on progress bar.
1 parent 9ec0cc3 commit 0ca8b4d

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

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

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
#if TEAMEXPLORER15
2-
// Microsoft.VisualStudio.Shell.Framework has an alias to avoid conflict with IAsyncServiceProvider
3-
extern alias SF15;
4-
using ServiceProgressData = SF15::Microsoft.VisualStudio.Shell.ServiceProgressData;
5-
#endif
6-
7-
using System;
8-
using System.Threading;
1+
using System;
92
using System.Collections.Generic;
103
using System.Diagnostics.CodeAnalysis;
114
using System.ComponentModel.Composition;
@@ -90,22 +83,14 @@ public async Task Clone(
9083
await StartClonenOnConnectPageAsync(teamExplorer, cloneUrl, clonePath, recurseSubmodules);
9184
NavigateToHomePage(teamExplorer); // Show progress on Team Explorer - Home
9285
await WaitForCloneOnHomePageAsync(teamExplorer);
93-
#elif TEAMEXPLORER15
94-
var gitExt = serviceProvider.GetService<IGitActionsExt>();
95-
var typedProgress = ((Progress<ServiceProgressData>)progress) ?? new Progress<ServiceProgressData>();
96-
typedProgress.ProgressChanged += (s, e) => statusBar.Value.ShowMessage(e.ProgressText);
97-
var cloneTask = gitExt.CloneAsync(cloneUrl, clonePath, recurseSubmodules, default(CancellationToken), typedProgress);
98-
99-
NavigateToHomePage(teamExplorer); // Show progress on Team Explorer - Home
100-
await cloneTask;
101-
#elif TEAMEXPLORER16
86+
#elif TEAMEXPLORER15 || TEAMEXPLORER16
10287
// The ServiceProgressData type is in a Visual Studio 2019 assembly that we don't currently have access to.
10388
// Using reflection to call the CloneAsync in order to avoid conflicts with the Visual Studio 2017 version.
10489
// Progress won't be displayed on the status bar, but it appears prominently on the Team Explorer Home view.
10590
var gitExt = serviceProvider.GetService<IGitActionsExt>();
10691
var cloneAsyncMethod = typeof(IGitActionsExt).GetMethod(nameof(IGitActionsExt.CloneAsync));
10792
Assumes.NotNull(cloneAsyncMethod);
108-
var cloneParameters = new object[] { cloneUrl, clonePath, recurseSubmodules, default(CancellationToken), null };
93+
var cloneParameters = new object[] { cloneUrl, clonePath, recurseSubmodules, default, null };
10994
var cloneTask = (Task)cloneAsyncMethod.Invoke(gitExt, cloneParameters);
11095

11196
NavigateToHomePage(teamExplorer); // Show progress on Team Explorer - Home

0 commit comments

Comments
 (0)