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

Commit 1dff182

Browse files
authored
Merge branch 'master' into fixes/1704-clean-MEF-log-VS2017
2 parents c9703cd + 7d84837 commit 1dff182

File tree

54 files changed

+704
-174
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

+704
-174
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '2.5.3.{build}'
1+
version: '2.5.4.{build}'
22
skip_tags: true
33
install:
44
- ps: |

src/CredentialManagement/CredentialManagement.csproj

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

src/GitHub.Api/GitHub.Api.csproj

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

src/GitHub.App/Api/ApiClient.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,24 @@ public IObservable<PullRequestReviewComment> CreatePullRequestReviewComment(
110110
return gitHubClient.PullRequest.ReviewComment.CreateReply(owner, name, number, comment);
111111
}
112112

113+
public IObservable<PullRequestReviewComment> EditPullRequestReviewComment(
114+
string owner,
115+
string name,
116+
int number,
117+
string body)
118+
{
119+
var pullRequestReviewCommentEdit = new PullRequestReviewCommentEdit(body);
120+
return gitHubClient.PullRequest.ReviewComment.Edit(owner, name, number, pullRequestReviewCommentEdit);
121+
}
122+
123+
public IObservable<Unit> DeletePullRequestReviewComment(
124+
string owner,
125+
string name,
126+
int number)
127+
{
128+
return gitHubClient.PullRequest.ReviewComment.Delete(owner, name, number);
129+
}
130+
113131
public IObservable<Gist> CreateGist(NewGist newGist)
114132
{
115133
return gitHubClient.Gist.Create(newGist);

src/GitHub.App/GitHub.App.csproj

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

src/GitHub.App/Services/GitClient.cs

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

9797
public Task Fetch(IRepository repo, UriString cloneUrl, params string[] refspecs)
9898
{
99-
var httpsUrl = UriString.ToUriString(cloneUrl.ToRepositoryUrl());
99+
var httpsString = cloneUrl.ToRepositoryUrl().ToString();
100100

101-
var originRemote = repo.Network.Remotes[defaultOriginName];
102-
if (originRemote != null && originRemote.Url == httpsUrl)
101+
foreach (var remote in repo.Network.Remotes)
103102
{
104-
return Fetch(repo, defaultOriginName, refspecs);
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))
112+
{
113+
return Fetch(repo, defaultOriginName, refspecs);
114+
}
105115
}
106116

107117
return Task.Factory.StartNew(() =>
108118
{
109119
try
110120
{
111121
var tempRemoteName = cloneUrl.Owner + "-" + Guid.NewGuid();
112-
var remote = repo.Network.Remotes.Add(tempRemoteName, httpsUrl);
122+
var remote = repo.Network.Remotes.Add(tempRemoteName, httpsString);
113123
try
114124
{
115125
#pragma warning disable 0618 // TODO: Replace `Network.Fetch` with `Commands.Fetch`.

src/GitHub.App/Services/PullRequestService.cs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,25 +150,40 @@ public IObservable<bool> IsWorkingDirectoryClean(ILocalRepositoryModel repositor
150150
using (var repo = gitService.GetRepository(repository.LocalPath))
151151
{
152152
var statusOptions = new StatusOptions { ExcludeSubmodules = true };
153-
var isClean = !IsFilthy(repo.RetrieveStatus(statusOptions));
153+
var status = repo.RetrieveStatus(statusOptions);
154+
var isClean = !IsCheckoutBlockingDirty(status);
154155
return Observable.Return(isClean);
155156
}
156157
}
157158

158-
static bool IsFilthy(RepositoryStatus status)
159+
static bool IsCheckoutBlockingDirty(RepositoryStatus status)
159160
{
160161
if (status.IsDirty)
161162
{
162-
// This is similar to IsDirty, but also allows NewInWorkdir files
163-
return status.Any(entry =>
164-
entry.State != FileStatus.Ignored &&
165-
entry.State != FileStatus.Unaltered &&
166-
entry.State != FileStatus.NewInWorkdir);
163+
return status.Any(entry => IsCheckoutBlockingChange(entry));
167164
}
168165

169166
return false;
170167
}
171168

169+
// This is similar to IsDirty, but also allows NewInWorkdir and DeletedFromWorkdir files
170+
static bool IsCheckoutBlockingChange(StatusEntry entry)
171+
{
172+
switch (entry.State)
173+
{
174+
case FileStatus.Ignored:
175+
return false;
176+
case FileStatus.Unaltered:
177+
return false;
178+
case FileStatus.NewInWorkdir:
179+
return false;
180+
case FileStatus.DeletedFromWorkdir:
181+
return false;
182+
default:
183+
return true;
184+
}
185+
}
186+
172187
public IObservable<Unit> Pull(ILocalRepositoryModel repository)
173188
{
174189
return Observable.Defer(async () =>

src/GitHub.App/Services/TeamExplorerContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async void Refresh()
7878
var newBranchName = repo?.CurrentBranch?.Name;
7979
var newHeadSha = repo?.CurrentBranch?.Sha;
8080
var newTrackedSha = repo?.CurrentBranch?.TrackedSha;
81-
var newPullRequest = await pullRequestService.GetPullRequestForCurrentBranch(repo);
81+
var newPullRequest = repo != null ? await pullRequestService.GetPullRequestForCurrentBranch(repo) : null;
8282

8383
if (newRepositoryPath != repositoryPath)
8484
{

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Globalization;
23
using System.Collections.Generic;
34
using System.ComponentModel.Composition;
45
using System.IO;
@@ -328,7 +329,7 @@ public async Task InitializeAsync(
328329
LocalRepository = localRepository;
329330
RemoteRepositoryOwner = owner;
330331
Number = number;
331-
WebUrl = LocalRepository.CloneUrl.ToRepositoryUrl().Append("pull/" + number);
332+
WebUrl = localRepository.CloneUrl.ToRepositoryUrl(owner).Append("pull/" + number);
332333
modelService = await modelServiceFactory.CreateAsync(connection);
333334

334335
await Refresh();

src/GitHub.Exports.Reactive/Api/IApiClient.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,30 @@ IObservable<PullRequestReviewComment> CreatePullRequestReviewComment(
9090
/// <returns></returns>
9191
IObservable<PullRequestReviewComment> CreatePullRequestReviewComment(string owner, string name, int number, string body, int inReplyTo);
9292

93+
/// <summary>
94+
/// Delete a PR review comment.
95+
/// </summary>
96+
/// <param name="owner">The repository owner.</param>
97+
/// <param name="name">The repository name.</param>
98+
/// <param name="number">The pull request comment number.</param>
99+
IObservable<Unit> DeletePullRequestReviewComment(
100+
string owner,
101+
string name,
102+
int number);
103+
104+
/// <summary>
105+
/// Edits a PR review comment.
106+
/// </summary>
107+
/// <param name="owner">The repository owner.</param>
108+
/// <param name="name">The repository name.</param>
109+
/// <param name="number">The pull request comment number.</param>
110+
/// <param name="body">The replacement comment body.</param>
111+
IObservable<PullRequestReviewComment> EditPullRequestReviewComment(
112+
string owner,
113+
string name,
114+
int number,
115+
string body);
116+
93117
IObservable<Branch> GetBranches(string owner, string repo);
94118
IObservable<Repository> GetRepositories();
95119
IObservable<Repository> GetRepository(string owner, string repo);

0 commit comments

Comments
 (0)