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

Commit a9ff71b

Browse files
committed
Merge master into feature/pr/tracking-list
2 parents ba26db7 + dc10a39 commit a9ff71b

File tree

54 files changed

+875
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+875
-308
lines changed

documentation/manifest.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# First Launch
2+
- **If last solution was in a git repo hosted on GitHub**
3+
- **Team Explorer Home page shows:**
4+
- [ ] GitHub header, repo information
5+
- [ ] Pull Requests button
6+
- [ ] Pulse button
7+
- [ ] Graphs button
8+
- [ ] Issues button
9+
- **If last solution was in a git repo not hosted on GitHub**
10+
- [ ] Team Explorer Home page does not show any github information
11+
- **Go to Team Explorer Connect page**
12+
- [ ] GitHub invitation section in Hosted Service Providers area is visible with Connect... and Sign up links
13+
- [ ] **Click on Connect**
14+
- [ ] Connect to GitHub dialog appears
15+
- [ ] GitHub option underlined
16+
- [ ] Cursor on username field
17+
- [ ] Login button disabled
18+
- [ ] Link to sign up at the bottom
19+
- [ ] **Fill out login information**
20+
- [ ] **On successful login**
21+
- [ ] Connect dialog disappears
22+
- [ ] GitHub invitation section in Connect page disappears
23+
- [ ] GitHub connection appears above Hosted Service Providers area with Clone, Create and Sign out action links. As long as it's above Local Git Repositories, it's good
24+
25+
# In Team Explorer Connect page (logged in)
26+
- [ ] **Click on Clone action link**
27+
- [ ] Clone dialog appears
28+
- [ ] List of user repositories is populated
29+
- [ ] Path field contains default cloning path C:\Users\[user]\Source\Repos
30+
- [ ] Cursor is in Search Repositories field
31+
- [ ] Clone button is disabled
32+
- [ ] Typing in the Search Repositories field filters the list
33+
- [ ] Clicking on the browse action link opens a file explorer
34+
- [ ] Selecting a directory in the file explorer changes the contents of the Path field to the new path
35+
- [ ] Selecting a repository from the list enables the clone button
36+
- [ ] ctrl-clicking a selection in the list removes the selection and disables the clone button
37+
- [ ] Hovering over the clone button (when enabled) animates the button (reversing colors)
38+
- [ ] **Select a repository and click Clone**
39+
- [ ] Clone dialog disappears
40+
- [ ] Progress bar appears in the Team Explorer Connect page with cloning progress (depending on repo size)
41+
- [ ] Notification appears in Team Explorer Connect page: "The repository was cloned successfully."
42+
- [ ] Repository shows up in the "Local Git Repositories" list
43+
- [ ] **Double-click the cloned repository in the "Local Git Repositories" list**
44+
- [ ] Team Explorer view changes to Home page
45+
- [ ] GitHub header and repo information is shown
46+
- [ ] **Click on Create action link**
47+
- [ ] Create dialog appears
48+
- [ ] Cursor is on the Name field
49+
- [ ] Create button is disabled
50+
- [ ] Local path is set to default cloning path C:\Users\[user]\Source\Repos
51+
- [ ] Git ignore is set to VisualStudio
52+
- [ ] User is set to current logged user
53+
- [ ] Tabbing through the fields follows visual placement of fields
54+
- [ ] Filling the name field enables the Create button
55+
- [ ] Hovering over the Create button animates it (reversing colors)
56+
- [ ] Clicking on the browse action link opens a file explorer
57+
- [ ] Selecting a directory in the file explorer changes the contents of the Path field to the new path
58+
- [ ] **Fill out the name field and click Create**
59+
- [ ] Dialog disappears
60+
- [ ] Notification appears in Team Explorer Connect page: "The repository was created successfully"
61+
- [ ] Repository shows up in the "Local Git Repositories" list
62+
- [ ] **Double-click the created repository in the "Local Git Repositories" list**
63+
- [ ] Team Explorer view changes to Home page
64+
- [ ] GitHub header and repo information is shown
65+
- [ ] **Publishing a local repo**
66+
- [ ] File - New - Project - Console Application (or any type of project, doesn't matter much)
67+
- [ ] Select "Add to source control" from the dialog and click Ok
68+
- [ ] Select "Git" from the Choose Source Control dialog
69+
- [ ] Verify that Team Explorer home page does *not* have a GitHub section
70+
- [ ] **Click "Sync"**
71+
- [ ] Synchronization page opens with "Publish to GitHub" section
72+
- [ ] **Click "Get Started" in the "Publish to GitHub" section**
73+
- [ ] Contents of section change to a publish form with:
74+
- [ ] User dropdown
75+
- [ ] Pre-filled name field with project name
76+
- [ ] Description field
77+
- [ ] Private checkbox
78+
- [ ] Publish button
79+
- [ ] **Publish button is enabled and private checkbox is unchecked (and disabled if user cannot create private repos)**
80+
- [ ] Click on "Publish"
81+
- [ ] Form becomes disabled
82+
- [ ] Progress bar appears above Synchronization title
83+
- [ ] Team Explorer view changes to Home page
84+
- [ ] Notification appears: "Repository published successfully"
85+
86+
# Connect page when logged in to TFS
87+
- [ ] **Connect to a TFS project**
88+
- [ ] Login to GitHub
89+
- [ ] Team Explorer Connect page: GitHub section appears above TFS section with Clone | Create | Sign out links
90+
- [ ] Log out of GitHub
91+
- [ ] Team Explorer Connect page: GitHub section appears above TFS section with Clone | Create | Login links
92+
- [ ] Disconnect from TFS (right click on project and "Remove"
93+
- [ ] Team Explorer Connect page: GitHub invitation section appears in Hosted Service Providers with Connect.. and Sign up links
94+
95+
# Connections
96+
- [ ] **Login to GitHub.com, then click on the "Manage Connections" header and "Connect to GitHub"**
97+
- [ ] Login dialog appears
98+
- [ ] GitHub Enterprise is underlined
99+
- [ ] Form has 3 fields - username, password and address
100+
- [ ] Login button is disabled
101+
- [ ] **Login to an enterprise instance**
102+
- [ ] Team Explorer Connect page shows two github connections - one titled GitHub, another with the enterprise url

src/DesignTimeStyleHelper/App.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ T Create<T>() where T : class
110110
return new Mock<T>().Object;
111111
}
112112

113-
object Create(Type t)
113+
static object Create(Type t)
114114
{
115115
var moq = typeof(Mock<>).MakeGenericType(t);
116116
var ctor = moq.GetConstructor(new Type[] { });
117-
var m = ctor.Invoke(new object[] { }) as Mock;
118-
return m.Object;
117+
var m = ctor?.Invoke(new object[] { }) as Mock;
118+
return m?.Object;
119119
}
120120

121121
public ExportProvider DefaultExportProvider { get; set; }

src/GitHub.Exports/Exports/ExportMetadata.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ public enum UIViewType {
1717
Clone,
1818
Publish,
1919
End = 100,
20-
Finished
21-
}
20+
Finished,
21+
GitHubPane,
22+
}
2223

2324
[MetadataAttribute]
2425
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]

src/GitHub.Exports/Extensions/VSExtensions.cs

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
using System;
2+
using System.ComponentModel.Design;
23
using System.Diagnostics;
4+
using GitHub.Primitives;
35
using GitHub.Services;
6+
using LibGit2Sharp;
47
using Microsoft.TeamFoundation.Controls;
8+
using Microsoft.VisualStudio;
9+
using Microsoft.VisualStudio.Shell;
10+
using Microsoft.VisualStudio.Shell.Interop;
511

612
namespace GitHub.Extensions
713
{
8-
public static class VSExtensions
14+
public static class IServiceProviderExtensions
915
{
1016
static IUIProvider cachedUIProvider = null;
1117

@@ -75,5 +81,54 @@ static T GetExportedValueAndCache<T, CacheType>(ref CacheType cache)
7581
cache = (CacheType)(object)ret;
7682
return ret;
7783
}
84+
85+
public static void AddTopLevelMenuItem(this IServiceProvider provider,
86+
Guid guid,
87+
int cmdId,
88+
EventHandler eventHandler)
89+
{
90+
var mcs = provider.GetService(typeof(IMenuCommandService)) as IMenuCommandService;
91+
Debug.Assert(mcs != null, "No IMenuCommandService? Something is wonky");
92+
if (mcs == null)
93+
return;
94+
var id = new CommandID(guid, cmdId);
95+
var item = new MenuCommand(eventHandler, id);
96+
mcs.AddCommand(item);
97+
}
98+
99+
public static void AddDynamicMenuItem(this IServiceProvider provider,
100+
Guid guid,
101+
int cmdId,
102+
Func<bool> canEnable,
103+
Action execute)
104+
{
105+
var mcs = provider.GetService(typeof(IMenuCommandService)) as IMenuCommandService;
106+
Debug.Assert(mcs != null, "No IMenuCommandService? Something is wonky");
107+
if (mcs == null)
108+
return;
109+
var id = new CommandID(guid, cmdId);
110+
var item = new OleMenuCommand(
111+
(s, e) => execute(),
112+
(s, e) => { },
113+
(s, e) =>
114+
{
115+
((OleMenuCommand)s).Visible = canEnable();
116+
},
117+
id);
118+
mcs.AddCommand(item);
119+
}
120+
}
121+
122+
public static class ISolutionExtensions
123+
{
124+
public static IRepository GetRepoFromSolution(this IVsSolution solution)
125+
{
126+
string solutionDir, solutionFile, userFile;
127+
if (!ErrorHandler.Succeeded(solution.GetSolutionInfo(out solutionDir, out solutionFile, out userFile)))
128+
return null;
129+
if (solutionDir == null)
130+
return null;
131+
return GitService.GitServiceHelper.GetRepo(solutionDir);
132+
}
78133
}
79134
}

src/GitHub.Exports/GitHub.Exports.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
<ItemGroup>
127127
<Compile Include="Authentication\AuthenticationResultExtensions.cs" />
128128
<Compile Include="Extensions\VSExtensions.cs" />
129+
<Compile Include="ViewModels\IServiceProviderAware.cs" />
129130
<Compile Include="UI\IView.cs" />
130131
<Compile Include="UI\Octicon.cs" />
131132
<Compile Include="ViewModels\IGitHubConnectSection.cs" />
@@ -146,6 +147,7 @@
146147
<Compile Include="Services\IUIProvider.cs" />
147148
<Compile Include="Services\IWikiProbe.cs" />
148149
<Compile Include="Services\WikiProbe.cs" />
150+
<Compile Include="ViewModels\IGitHubPaneViewModel.cs" />
149151
<Compile Include="ViewModels\ILoginViewModel.cs" />
150152
<Compile Include="Primitives\HostAddress.cs" />
151153
<Compile Include="UI\IUIController.cs" />

src/GitHub.Exports/Helpers/NotificationAwareObject.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using System.ComponentModel;
2+
using GitHub.VisualStudio.Helpers;
23

34
namespace GitHub.Primitives
45
{
5-
public abstract class NotificationAwareObject : INotifyPropertyChanged
6+
public abstract class NotificationAwareObject : INotifyPropertyChanged, INotifyPropertySource
67
{
78
public event PropertyChangedEventHandler PropertyChanged;
89

src/GitHub.Exports/Primitives/HostAddress.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public override bool Equals(object obj)
9898
if (ReferenceEquals(this, obj))
9999
return true;
100100
var other = obj as HostAddress;
101-
return obj != null && WebUri.IsSameHost(other.WebUri) && ApiUri.IsSameHost(other.ApiUri);
101+
return other != null && WebUri.IsSameHost(other.WebUri) && ApiUri.IsSameHost(other.ApiUri);
102102
}
103103
}
104104
}

src/GitHub.Exports/Primitives/UriString.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ bool ParseScpSyntax(string scpString)
108108
Host = match.Groups["host"].Value.ToNullIfEmpty();
109109
Owner = match.Groups["owner"].Value.ToNullIfEmpty();
110110
RepositoryName = GetRepositoryName(match.Groups["repo"].Value);
111+
IsScpUri = true;
111112
return true;
112113
}
113114
return false;
@@ -123,15 +124,18 @@ bool ParseScpSyntax(string scpString)
123124

124125
public bool IsFileUri { get; private set; }
125126

127+
public bool IsScpUri { get; private set; }
128+
126129
public bool IsValidUri => url != null;
127130

128131
/// <summary>
129132
/// Attempts a best-effort to convert the remote origin to a GitHub Repository URL.
130133
/// </summary>
131-
/// <returns></returns>
134+
/// <returns>A converted uri, or the existing one if we can't convert it (which might be null)</returns>
132135
public Uri ToRepositoryUrl()
133136
{
134-
if (url != null && IsFileUri) return url;
137+
// we only want to process urls that represent network resources
138+
if (!IsScpUri && (!IsValidUri || IsFileUri)) return url;
135139

136140
var scheme = url != null && IsHypertextTransferProtocol
137141
? url.Scheme

src/GitHub.Exports/Services/GitService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ public static UriString GetOriginUri(IRepository repo)
167167
{
168168
return repo
169169
?.Network
170-
.Remotes
171-
.FirstOrDefault(x => x.Name.Equals("origin", StringComparison.Ordinal))
170+
.Remotes["origin"]
172171
?.Url;
173172
}
174173

src/GitHub.Exports/Services/Services.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,5 @@ public static UriString GetRepoUrlFromSolution(IVsSolution solution)
100100
return null;
101101
return GitService.GitServiceHelper.GetUri(solutionDir);
102102
}
103-
104-
public static IRepository GetRepoFromSolution(this IVsSolution solution)
105-
{
106-
string solutionDir, solutionFile, userFile;
107-
if (!ErrorHandler.Succeeded(solution.GetSolutionInfo(out solutionDir, out solutionFile, out userFile)))
108-
return null;
109-
if (solutionDir == null)
110-
return null;
111-
return GitService.GitServiceHelper.GetRepo(solutionDir);
112-
}
113103
}
114104
}

0 commit comments

Comments
 (0)