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

Commit 307b45a

Browse files
committed
Merge branch 'master' into refactor/pr-list
2 parents a94466b + 3b49cdb commit 307b45a

File tree

155 files changed

+3178
-960
lines changed

Some content is hidden

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

155 files changed

+3178
-960
lines changed

GitHubVS.sln

Lines changed: 109 additions & 41 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Beta releases will have `(beta)` in their title in the gallery, following the ve
3535

3636
## Build requirements
3737

38-
* Visual Studio 2015+
38+
* Visual Studio 2017 (15.7.4)+
3939
* Visual Studio SDK
4040

4141
## Build
@@ -50,13 +50,13 @@ git submodule deinit script
5050
git submodule update
5151
```
5252

53-
Open the `GitHubVS.sln` solution with Visual Studio 2015+.
53+
Open the `GitHubVS.sln` solution with Visual Studio 2017+.
5454
To be able to use the GitHub API, you'll need to:
5555

5656
- [Register a new developer application](https://github.com/settings/developers) in your profile.
5757
- Open [src/GitHub.Api/ApiClientConfiguration_User.cs](src/GitHub.Api/ApiClientConfiguration_User.cs) and fill out the clientId/clientSecret fields for your application. **Note this has recently changed location, so you may need to re-do this**
5858

59-
Build using Visual Studio 2015 or:
59+
Build using Visual Studio 2017 or:
6060

6161
```txt
6262
build.cmd
@@ -95,7 +95,7 @@ Visit the [Contributor Guidelines](CONTRIBUTING.md) for details on how to contri
9595

9696
## Copyright
9797

98-
Copyright 2015 - 2017 GitHub, Inc.
98+
Copyright 2015 - 2018 GitHub, Inc.
9999

100100
Licensed under the [MIT License](LICENSE.md)
101101

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
os: Visual Studio 2017
12
version: '2.5.4.{build}'
23
skip_tags: true
34
install:

scripts/modules.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ New-Module -ScriptBlock {
9999

100100
New-Module -ScriptBlock {
101101
function Find-MSBuild() {
102-
if (Test-Path "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe") {
103-
$msbuild = "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
102+
if (Test-Path "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\MSBuild.exe") {
103+
$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\bin\MSBuild.exe"
104104
}
105105
elseif (Test-Path "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe") {
106106
$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe"

scripts/test.ps1

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,64 @@ if (!$?) {
3737
$exitcode = 1
3838
}
3939

40-
Write-Output "Running GitHub.UI.UnitTests..."
41-
Run-NUnit test GitHub.UI.UnitTests $TimeoutDuration $config
40+
Write-Output "Running GitHub.Api.UnitTests..."
41+
Run-NUnit test GitHub.Api.UnitTests $TimeoutDuration $config
4242
if (!$?) {
4343
$exitcode = 2
4444
}
4545

46-
Write-Output "Running UnitTests..."
47-
Run-NUnit test UnitTests $TimeoutDuration $config
46+
Write-Output "Running GitHub.App.UnitTests..."
47+
Run-NUnit test GitHub.App.UnitTests $TimeoutDuration $config
4848
if (!$?) {
4949
$exitcode = 3
5050
}
5151

52+
Write-Output "Running GitHub.Exports.Reactive.UnitTests..."
53+
Run-NUnit test GitHub.Exports.Reactive.UnitTests $TimeoutDuration $config
54+
if (!$?) {
55+
$exitcode = 4
56+
}
57+
58+
Write-Output "Running GitHub.Exports.UnitTests..."
59+
Run-NUnit test GitHub.Exports.UnitTests $TimeoutDuration $config
60+
if (!$?) {
61+
$exitcode = 5
62+
}
63+
64+
Write-Output "Running GitHub.Extensions.UnitTests..."
65+
Run-NUnit test GitHub.Extensions.UnitTests $TimeoutDuration $config
66+
if (!$?) {
67+
$exitcode = 6
68+
}
69+
70+
Write-Output "Running GitHub.Primitives.UnitTests..."
71+
Run-NUnit test GitHub.Primitives.UnitTests $TimeoutDuration $config
72+
if (!$?) {
73+
$exitcode = 7
74+
}
75+
76+
Write-Output "Running GitHub.TeamFoundation.UnitTests..."
77+
Run-NUnit test GitHub.TeamFoundation.UnitTests $TimeoutDuration $config
78+
if (!$?) {
79+
$exitcode = 8
80+
}
81+
82+
Write-Output "Running GitHub.UI.UnitTests..."
83+
Run-NUnit test GitHub.UI.UnitTests $TimeoutDuration $config
84+
if (!$?) {
85+
$exitcode = 9
86+
}
87+
88+
Write-Output "Running GitHub.VisualStudio.UnitTests..."
89+
Run-NUnit test GitHub.VisualStudio.UnitTests $TimeoutDuration $config
90+
if (!$?) {
91+
$exitcode = 10
92+
}
93+
5294
Write-Output "Running GitHub.InlineReviews.UnitTests..."
5395
Run-NUnit test GitHub.InlineReviews.UnitTests $TimeoutDuration $config
5496
if (!$?) {
55-
$exitcode = 4
97+
$exitcode = 11
5698
}
5799

58100
if ($exitcode -ne 0) {

src/CredentialManagement/CredentialManagement.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>CredentialManagement</RootNamespace>
1111
<AssemblyName>GitHub.CredentialManagement</AssemblyName>
12-
<LangVersion>6</LangVersion>
12+
<LangVersion>7.3</LangVersion>
1313
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
1414
<FileAlignment>512</FileAlignment>
1515
<CodeAnalysisRuleSet>..\common\GitHubVS.ruleset</CodeAnalysisRuleSet>

src/GitHub.Api/GitHub.Api.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>GitHub.Api</RootNamespace>
1111
<AssemblyName>GitHub.Api</AssemblyName>
12-
<LangVersion>6</LangVersion>
12+
<LangVersion>7.3</LangVersion>
1313
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
1414
<FileAlignment>512</FileAlignment>
1515
<CodeAnalysisRuleSet>..\common\GitHubVS.ruleset</CodeAnalysisRuleSet>

src/GitHub.App/GitHub.App.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<AppDesignerFolder>Properties</AppDesignerFolder>
1212
<RootNamespace>GitHub.App</RootNamespace>
1313
<AssemblyName>GitHub.App</AssemblyName>
14-
<LangVersion>6</LangVersion>
14+
<LangVersion>7.3</LangVersion>
1515
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
1616
<FileAlignment>512</FileAlignment>
1717
<CodeAnalysisRuleSet>..\common\GitHubVS.ruleset</CodeAnalysisRuleSet>

src/GitHub.App/Services/GitClient.cs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,30 +96,30 @@ public Task Fetch(IRepository repository, string remoteName)
9696

9797
public Task Fetch(IRepository repo, UriString cloneUrl, params string[] refspecs)
9898
{
99-
var httpsString = cloneUrl.ToRepositoryUrl().ToString();
100-
10199
foreach (var remote in repo.Network.Remotes)
102100
{
103-
var remoteUrl = new UriString(remote.Url);
104-
if (!remoteUrl.IsHypertextTransferProtocol)
105-
{
106-
// Only match http urls
107-
continue;
108-
}
109-
110-
var remoteHttpsString = remoteUrl.ToRepositoryUrl().ToString();
111-
if (remoteHttpsString.Equals(httpsString, StringComparison.OrdinalIgnoreCase))
101+
if (UriString.RepositoryUrlsAreEqual(new UriString(remote.Url), cloneUrl))
112102
{
113-
return Fetch(repo, defaultOriginName, refspecs);
103+
return Fetch(repo, remote.Name, refspecs);
114104
}
115105
}
116106

117107
return Task.Factory.StartNew(() =>
118108
{
119109
try
120110
{
121-
var tempRemoteName = cloneUrl.Owner + "-" + Guid.NewGuid();
122-
var remote = repo.Network.Remotes.Add(tempRemoteName, httpsString);
111+
var remoteName = cloneUrl.Owner;
112+
var remoteUri = cloneUrl.ToRepositoryUrl();
113+
114+
var removeRemote = false;
115+
if (repo.Network.Remotes[remoteName] != null)
116+
{
117+
// If a remote with this neme already exists, use a unique name and remove remote afterwards
118+
remoteName = cloneUrl.Owner + "-" + Guid.NewGuid();
119+
removeRemote = true;
120+
}
121+
122+
var remote = repo.Network.Remotes.Add(remoteName, remoteUri.ToString());
123123
try
124124
{
125125
#pragma warning disable 0618 // TODO: Replace `Network.Fetch` with `Commands.Fetch`.
@@ -128,7 +128,10 @@ public Task Fetch(IRepository repo, UriString cloneUrl, params string[] refspecs
128128
}
129129
finally
130130
{
131-
repo.Network.Remotes.Remove(tempRemoteName);
131+
if (removeRemote)
132+
{
133+
repo.Network.Remotes.Remove(remoteName);
134+
}
132135
}
133136
}
134137
catch (Exception ex)

src/GitHub.App/Services/PullRequestService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ async Task<string> CreateRemote(IRepository repo, UriString cloneUri)
670670
{
671671
foreach (var remote in repo.Network.Remotes)
672672
{
673-
if (remote.Url == cloneUri)
673+
if (UriString.RepositoryUrlsAreEqual(new UriString(remote.Url), cloneUri))
674674
{
675675
return remote.Name;
676676
}
@@ -704,7 +704,7 @@ async Task ExtractToTempFile(
704704
string tempFilePath)
705705
{
706706
string contents;
707-
707+
708708
try
709709
{
710710
contents = await gitClient.ExtractFile(repo, commitSha, relativePath) ?? string.Empty;
@@ -787,7 +787,7 @@ static string GetSafeBranchName(string name)
787787
{
788788
var before = InvalidBranchCharsRegex.Replace(name, "-").TrimEnd('-');
789789

790-
for (;;)
790+
for (; ; )
791791
{
792792
string after = before.Replace("--", "-");
793793

0 commit comments

Comments
 (0)