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

Commit f82a4f9

Browse files
authored
Merge branch 'master' into features/check-suite-annotations-expanders
2 parents 4662521 + 29a398d commit f82a4f9

File tree

31 files changed

+1043
-237
lines changed

31 files changed

+1043
-237
lines changed

GitHubVS.sln

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InstallAndStart", "test\Lau
135135
EndProject
136136
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.TeamFoundation.16", "src\GitHub.TeamFoundation.16\GitHub.TeamFoundation.16.csproj", "{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}"
137137
EndProject
138+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.Services.Vssdk.UnitTests", "test\GitHub.Services.Vssdk.UnitTests\GitHub.Services.Vssdk.UnitTests.csproj", "{65542DEE-D3BE-4810-B85A-08E970413A21}"
139+
EndProject
138140
Global
139141
GlobalSection(SolutionConfigurationPlatforms) = preSolution
140142
Debug|Any CPU = Debug|Any CPU
@@ -471,6 +473,16 @@ Global
471473
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.Release|Any CPU.Build.0 = Release|Any CPU
472474
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.ReleaseWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
473475
{F08BD4BC-B5DF-4193-9B01-6D0BBE101BD7}.ReleaseWithoutVsix|Any CPU.Build.0 = Release|Any CPU
476+
{65542DEE-D3BE-4810-B85A-08E970413A21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
477+
{65542DEE-D3BE-4810-B85A-08E970413A21}.Debug|Any CPU.Build.0 = Debug|Any CPU
478+
{65542DEE-D3BE-4810-B85A-08E970413A21}.DebugCodeAnalysis|Any CPU.ActiveCfg = Debug|Any CPU
479+
{65542DEE-D3BE-4810-B85A-08E970413A21}.DebugCodeAnalysis|Any CPU.Build.0 = Debug|Any CPU
480+
{65542DEE-D3BE-4810-B85A-08E970413A21}.DebugWithoutVsix|Any CPU.ActiveCfg = Debug|Any CPU
481+
{65542DEE-D3BE-4810-B85A-08E970413A21}.DebugWithoutVsix|Any CPU.Build.0 = Debug|Any CPU
482+
{65542DEE-D3BE-4810-B85A-08E970413A21}.Release|Any CPU.ActiveCfg = Release|Any CPU
483+
{65542DEE-D3BE-4810-B85A-08E970413A21}.Release|Any CPU.Build.0 = Release|Any CPU
484+
{65542DEE-D3BE-4810-B85A-08E970413A21}.ReleaseWithoutVsix|Any CPU.ActiveCfg = Release|Any CPU
485+
{65542DEE-D3BE-4810-B85A-08E970413A21}.ReleaseWithoutVsix|Any CPU.Build.0 = Release|Any CPU
474486
EndGlobalSection
475487
GlobalSection(SolutionProperties) = preSolution
476488
HideSolutionNode = FALSE
@@ -502,6 +514,7 @@ Global
502514
{86C54B27-717F-478C-AC8C-01F1C68A56C5} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AB9}
503515
{C6E8D1E1-FAAC-4E02-B6A1-6164EC5E704E} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AB9}
504516
{E899B03C-6E8E-4375-AB65-FC925D721D8B} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AB9}
517+
{65542DEE-D3BE-4810-B85A-08E970413A21} = {8A7DA2E7-262B-4581-807A-1C45CE79CDFD}
505518
EndGlobalSection
506519
GlobalSection(ExtensibilityGlobals) = postSolution
507520
SolutionGuid = {556014CF-5B35-4CE5-B3EF-6AB0007001AC}

azure-pipelines.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# .NET Desktop
2+
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
3+
# Add steps that publish symbols, save build artifacts, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
5+
6+
pool:
7+
vmImage: 'VS2017-Win2016'
8+
9+
variables:
10+
solution: '**/*.sln'
11+
buildPlatform: 'Any CPU'
12+
buildConfiguration: 'Release'
13+
14+
steps:
15+
- task: InstallSSHKey@0
16+
inputs:
17+
hostName: github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
18+
sshPublicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCx/AxLjr4mhH7XFlbISb65GBxQnVnKh1owmAT1bK/Qt1b4/Z0SL68IvV88DpgLyKbica2giEVfKo/Z4dkO+P8M2bGXrNgazzfO910DlR+e1vt8BSU/Dbvscz0i1lsfKb3PnfSouCkQev6Th0v+hBdgkuackWgaBw22DDLkp9Uf/cAo+QYLz56p5KVctEESRRgGgIIlZyUc8OYDMSU2wQhG9x31mSyJ4ODuOZsi1RgBBHrgUb2QRhLJ9nZWfQgGBRDxGYTKLWiWIQwgSVQ9x1Az/Rei+CbPRvLcVGg+5vHt8lcu+HxEgrY4IsjXdMqosPqxQ+TT6f+G4GQDn8+IQ4wOpTVi84PkOQX3JPE2QSJwWA0AHNe5NTSns6WWYQyzxFJYBN2pLPuMnj9/+ozV3GaeQqn47WHfUH3s5IawNQPTFDxcl4qsmU66Ybfqa4eFIPEvCCp1leQcuXyDHxKLq80x1szN4kn0oyL2W0zbkwTaZG4I5l4Rto0hErUf3qx7FlZjMGEFMdJVskgnRMkKdqngF0FmSYQICpmqqYD8TydUc6jxZVOCvFF5gbqwxV/F2lk10D7FnetUNeWvpcZKbFUX4e5Ff15vibJZp4/5FUbksv+glfbPwk6tGuNj3xPFODP7KG8Y5wtcbknX11XI0vi+iL8TxL0Vk30TpZUMXWYYvQ==
19+
sshKeySecureFile: id_rsa
20+
21+
- script: git submodule init && git submodule deinit script && git submodule update
22+
displayName: Submodule init
23+
24+
# Can't use the NuGet tasks because of https://github.com/Microsoft/azure-pipelines-tasks/issues/6790
25+
#- task: NuGetToolInstaller@0
26+
#- task: NuGetCommand@2
27+
# inputs:
28+
# restoreSolution: '$(solution)'
29+
# feedsToUse: 'config'
30+
# nugetConfigPath: nuget.config
31+
32+
# Instead run nuget manually.
33+
- script: tools\nuget\nuget.exe restore
34+
displayName: NuGet restore
35+
36+
# Ideally we'd run NerdBank.GitVersioning but that will come later. For now bump the
37+
# version with the azure BuildId
38+
- task: PowerShell@2
39+
inputs:
40+
targetType: filePath
41+
filePath: '$(Build.SourcesDirectory)\scripts\Bump-Version.ps1'
42+
arguments: -BumpBuild -BuildNumber:$(Build.BuildId)
43+
displayName: Bump version
44+
45+
- task: VSBuild@1
46+
inputs:
47+
solution: GitHubVS.sln
48+
platform: '$(buildPlatform)'
49+
configuration: '$(buildConfiguration)'
50+
51+
# VSTest is hanging. Skip tests for now; we're still running Appveyor which will handle the tests.
52+
#- task: VSTest@2
53+
# inputs:
54+
# searchFolder: '$(Build.SourcesDirectory)\test'
55+
# testAssemblyVer2: '**\bin\**\*Tests.dll'
56+
# platform: '$(buildPlatform)'
57+
# configuration: '$(buildConfiguration)'
58+
# diagnosticsEnabled: true
59+
# runSettingsFile: '$(Build.SourcesDirectory)\test\test.runsettings'
60+
61+
- task: PublishBuildArtifacts@1
62+
inputs:
63+
pathtoPublish: '$(Build.SourcesDirectory)\build\Release\GitHub.VisualStudio.vsix'
64+
artifactName: 'vsix'

nuget.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
4+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
55
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
66
<add key="vsixtesting" value="https://www.myget.org/F/vsixtesting/api/v3/index.json" />
77
<add key="Custom Packages for GHfVS" value="lib" />

src/GitHub.App/ViewModels/GitHubPane/GitHubPaneViewModel.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public sealed class GitHubPaneViewModel : ViewModelBase, IGitHubPaneViewModel, I
4545
readonly ILoggedOutViewModel loggedOut;
4646
readonly INotAGitHubRepositoryViewModel notAGitHubRepository;
4747
readonly INotAGitRepositoryViewModel notAGitRepository;
48+
readonly INoRemoteOriginViewModel noRemoteOrigin;
4849
readonly ILoginFailedViewModel loginFailed;
4950
readonly SemaphoreSlim navigating = new SemaphoreSlim(1);
5051
readonly ObservableAsPropertyHelper<ContentOverride> contentOverride;
@@ -72,6 +73,7 @@ public GitHubPaneViewModel(
7273
ILoggedOutViewModel loggedOut,
7374
INotAGitHubRepositoryViewModel notAGitHubRepository,
7475
INotAGitRepositoryViewModel notAGitRepository,
76+
INoRemoteOriginViewModel noRemoteOrigin,
7577
ILoginFailedViewModel loginFailed)
7678
{
7779
Guard.ArgumentNotNull(viewModelFactory, nameof(viewModelFactory));
@@ -84,6 +86,7 @@ public GitHubPaneViewModel(
8486
Guard.ArgumentNotNull(loggedOut, nameof(loggedOut));
8587
Guard.ArgumentNotNull(notAGitHubRepository, nameof(notAGitHubRepository));
8688
Guard.ArgumentNotNull(notAGitRepository, nameof(notAGitRepository));
89+
Guard.ArgumentNotNull(noRemoteOrigin, nameof(noRemoteOrigin));
8790
Guard.ArgumentNotNull(loginFailed, nameof(loginFailed));
8891

8992
this.viewModelFactory = viewModelFactory;
@@ -94,6 +97,7 @@ public GitHubPaneViewModel(
9497
this.loggedOut = loggedOut;
9598
this.notAGitHubRepository = notAGitHubRepository;
9699
this.notAGitRepository = notAGitRepository;
100+
this.noRemoteOrigin = noRemoteOrigin;
97101
this.loginFailed = loginFailed;
98102

99103
var contentAndNavigatorContent = Observable.CombineLatest(
@@ -433,8 +437,17 @@ async Task UpdateContent(LocalRepositoryModel repository)
433437
}
434438
else if (string.IsNullOrWhiteSpace(repository.CloneUrl))
435439
{
436-
log.Debug("Not a GitHub repository: {CloneUrl}", repository?.CloneUrl);
437-
Content = notAGitHubRepository;
440+
if (repository.HasRemotesButNoOrigin)
441+
{
442+
log.Debug("No origin remote");
443+
Content = noRemoteOrigin;
444+
}
445+
else
446+
{
447+
log.Debug("Not a GitHub repository: {CloneUrl}", repository?.CloneUrl);
448+
Content = notAGitHubRepository;
449+
}
450+
438451
return;
439452
}
440453

@@ -490,7 +503,7 @@ async Task UpdateContent(LocalRepositoryModel repository)
490503
Content = loggedOut;
491504
}
492505
}
493-
506+
494507
if (notGitHubRepo)
495508
{
496509
log.Debug("Not a GitHub repository: {CloneUrl}", repository?.CloneUrl);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Reactive;
3+
using System.Threading.Tasks;
4+
using System.ComponentModel.Composition;
5+
using GitHub.Services;
6+
using ReactiveUI;
7+
8+
namespace GitHub.ViewModels.GitHubPane
9+
{
10+
/// <summary>
11+
/// The view model for the "No Origin Remote" view in the GitHub pane.
12+
/// </summary>
13+
[Export(typeof(INoRemoteOriginViewModel))]
14+
[PartCreationPolicy(CreationPolicy.NonShared)]
15+
public class NoRemoteOriginViewModel : PanePageViewModelBase, INoRemoteOriginViewModel
16+
{
17+
ITeamExplorerServices teamExplorerServices;
18+
19+
[ImportingConstructor]
20+
public NoRemoteOriginViewModel(ITeamExplorerServices teamExplorerServices)
21+
{
22+
this.teamExplorerServices = teamExplorerServices;
23+
EditRemotes = ReactiveCommand.CreateFromTask(teamExplorerServices.ShowRepositorySettingsRemotesAsync);
24+
}
25+
26+
public ReactiveCommand<Unit, Unit> EditRemotes { get; }
27+
}
28+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Reactive;
2+
using ReactiveUI;
3+
4+
namespace GitHub.ViewModels.GitHubPane
5+
{
6+
/// <summary>
7+
/// Defines the view model for the "No Origin Remote" view in the GitHub pane.
8+
/// </summary>
9+
public interface INoRemoteOriginViewModel : IPanePageViewModel
10+
{
11+
/// <summary>
12+
/// Gets a command that will allow the user to rename remotes.
13+
/// </summary>
14+
ReactiveCommand<Unit, Unit> EditRemotes { get; }
15+
}
16+
}

src/GitHub.Exports/Models/BranchModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ namespace GitHub.Models
77
public class BranchModel : ICopyable<BranchModel>,
88
IEquatable<BranchModel>, IComparable<BranchModel>
99
{
10-
public BranchModel(string name, RepositoryModel repo, string sha, bool isTracking, string trackedSha) :
10+
public BranchModel(string name, RepositoryModel repo, string sha, bool isTracking, string trackedSha, string trackedRemoteName) :
1111
this(name, repo)
1212
{
1313
IsTracking = isTracking;
1414
Sha = sha;
1515
TrackedSha = trackedSha;
16+
TrackedRemoteName = trackedRemoteName;
1617
}
1718

1819
public BranchModel(string name, RepositoryModel repo)
@@ -32,6 +33,7 @@ public BranchModel(string name, RepositoryModel repo)
3233
public string DisplayName { get; set; }
3334
public string Sha { get; private set; }
3435
public string TrackedSha { get; private set; }
36+
public string TrackedRemoteName { get; private set; }
3537

3638
#region Equality things
3739
public void CopyFrom(BranchModel other)

src/GitHub.Exports/Models/LocalRepositoryModel.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using System.Diagnostics;
33
using System.Globalization;
44
using System.ComponentModel;
5+
using System.Collections.Generic;
6+
using GitHub.Primitives;
57

68
namespace GitHub.Models
79
{
@@ -22,6 +24,14 @@ public string LocalPath
2224
get; set;
2325
}
2426

27+
/// <summary>
28+
/// True if repository has remotes but none are named "origin".
29+
/// </summary>
30+
public bool HasRemotesButNoOrigin
31+
{
32+
get; set;
33+
}
34+
2535
/// <summary>
2636
/// Note: We don't consider CloneUrl a part of the hash code because it can change during the lifetime
2737
/// of a repository. Equals takes care of any hash collisions because of this

src/GitHub.Exports/Services/GitService.cs

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.IO;
33
using System.Linq;
44
using System.Threading.Tasks;
5+
using System.Collections.Generic;
56
using System.ComponentModel.Composition;
67
using GitHub.UI;
78
using GitHub.Models;
@@ -38,18 +39,29 @@ public LocalRepositoryModel CreateLocalRepositoryModel(string localPath)
3839
throw new ArgumentException("Path does not exist", nameof(localPath));
3940
}
4041

41-
var cloneUrl = GetUri(localPath);
42-
var name = cloneUrl?.RepositoryName ?? dir.Name;
43-
44-
var model = new LocalRepositoryModel
42+
using (var repository = GetRepository(localPath))
4543
{
46-
LocalPath = localPath,
47-
CloneUrl = cloneUrl,
48-
Name = name,
49-
Icon = Octicon.repo
50-
};
44+
UriString cloneUrl = null;
45+
bool noOrigin = false;
46+
if (repository != null)
47+
{
48+
cloneUrl = GetUri(repository);
49+
noOrigin = HasRemotesButNoOrigin(repository);
50+
}
5151

52-
return model;
52+
var name = cloneUrl?.RepositoryName ?? dir.Name;
53+
54+
var model = new LocalRepositoryModel
55+
{
56+
LocalPath = localPath,
57+
CloneUrl = cloneUrl,
58+
HasRemotesButNoOrigin = noOrigin,
59+
Name = name,
60+
Icon = Octicon.repo
61+
};
62+
63+
return model;
64+
}
5365
}
5466

5567
public BranchModel GetBranch(LocalRepositoryModel model)
@@ -68,7 +80,8 @@ public BranchModel GetBranch(LocalRepositoryModel model)
6880
repo: model,
6981
sha: branch.Tip?.Sha,
7082
isTracking: branch.IsTracking,
71-
trackedSha: branch.TrackedBranch?.Tip?.Sha);
83+
trackedSha: branch.TrackedBranch?.Tip?.Sha,
84+
trackedRemoteName: branch.TrackedBranch?.RemoteName);
7285
}
7386
}
7487

@@ -119,6 +132,17 @@ public IRepository GetRepository(string path)
119132
return repoPath == null ? null : repositoryFacade.NewRepository(repoPath);
120133
}
121134

135+
/// <summary>
136+
/// Find out if repository has remotes but none are called "origin".
137+
/// </summary>
138+
/// <param name="repo">The target repository.</param>
139+
/// <returns>True if repository has remotes but none are called "origin".</returns>
140+
public bool HasRemotesButNoOrigin(IRepository repo)
141+
{
142+
var remotes = repo.Network.Remotes;
143+
return remotes["origin"] == null && remotes.Any();
144+
}
145+
122146
/// <summary>
123147
/// Returns a <see cref="UriString"/> representing the uri of a remote
124148
/// </summary>

src/GitHub.Exports/Services/ITeamExplorerServices.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Windows.Input;
1+
using System.Threading.Tasks;
22

33
namespace GitHub.Services
44
{
@@ -7,6 +7,7 @@ public interface ITeamExplorerServices : INotificationService
77
void ShowConnectPage();
88
void ShowHomePage();
99
void ShowPublishSection();
10+
Task ShowRepositorySettingsRemotesAsync();
1011
void ClearNotifications();
1112
void OpenRepository(string repositoryPath);
1213
}

0 commit comments

Comments
 (0)