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

Commit cd0a367

Browse files
authored
Merge branch 'master' into feature/inline-reviews-tooltip
2 parents 909a8bf + bf27bc6 commit cd0a367

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

GitHubVS.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26403.7
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.VisualStudio", "src\GitHub.VisualStudio\GitHub.VisualStudio.csproj", "{11569514-5AE5-4B5B-92A2-F10B0967DE5F}"
77
ProjectSection(ProjectDependencies) = postProject

src/GitHub.App/Services/PullRequestService.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ public IObservable<Unit> Pull(ILocalRepositoryModel repository)
105105

106106
public IObservable<Unit> Push(ILocalRepositoryModel repository)
107107
{
108-
return Observable.Defer(() =>
108+
return Observable.Defer(async () =>
109109
{
110110
var repo = gitService.GetRepository(repository.LocalPath);
111-
return gitClient.Push(repo, repo.Head.TrackedBranch.UpstreamBranchCanonicalName, repo.Head.Remote.Name).ToObservable();
111+
var remote = await gitClient.GetHttpRemote(repo, repo.Head.Remote.Name);
112+
return gitClient.Push(repo, repo.Head.TrackedBranch.UpstreamBranchCanonicalName, remote.Name).ToObservable();
112113
});
113114
}
114115

@@ -171,8 +172,13 @@ public IObservable<BranchTrackingDetails> CalculateHistoryDivergence(ILocalRepos
171172
return Observable.Defer(async () =>
172173
{
173174
var repo = gitService.GetRepository(repository.LocalPath);
175+
174176
if (repo.Head.Remote != null)
175-
await gitClient.Fetch(repo, repo.Head.Remote.Name);
177+
{
178+
var remote = await gitClient.GetHttpRemote(repo, repo.Head.Remote.Name);
179+
await gitClient.Fetch(repo, remote.Name);
180+
}
181+
176182
return Observable.Return(repo.Head.TrackingDetails);
177183
});
178184
}

src/GitHub.InlineReviews/Peek/InlineCommentPeekableItem.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,19 @@ namespace GitHub.InlineReviews.Peek
77
{
88
class InlineCommentPeekableItem : IPeekableItem
99
{
10-
readonly InlineCommentPeekViewModel viewModel;
11-
1210
public InlineCommentPeekableItem(InlineCommentPeekViewModel viewModel)
1311
{
14-
this.viewModel = viewModel;
12+
ViewModel = viewModel;
1513
}
1614

1715
public string DisplayName => "GitHub Code Review";
16+
public InlineCommentPeekViewModel ViewModel { get; }
1817

1918
public IEnumerable<IPeekRelationship> Relationships => new[] { InlineCommentPeekRelationship.Instance };
2019

2120
public IPeekResultSource GetOrCreateResultSource(string relationshipName)
2221
{
23-
return new InlineCommentPeekableResultSource(viewModel);
22+
return new InlineCommentPeekableResultSource(ViewModel);
2423
}
2524
}
2625
}

src/GitHub.InlineReviews/Services/InlineCommentPeekService.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22
using System.ComponentModel.Composition;
3+
using System.Linq;
4+
using System.Reactive.Linq;
35
using System.Threading.Tasks;
46
using GitHub.Api;
57
using GitHub.Extensions;
@@ -96,7 +98,15 @@ public ITrackingPoint Show(ITextView textView, AddInlineCommentTag tag)
9698

9799
ExpandCollapsedRegions(textView, line.Extent);
98100

99-
peekBroker.TriggerPeekSession(textView, trackingPoint, InlineCommentPeekRelationship.Instance.Name);
101+
var session = peekBroker.TriggerPeekSession(textView, trackingPoint, InlineCommentPeekRelationship.Instance.Name);
102+
var item = session.PeekableItems.OfType<InlineCommentPeekableItem>().FirstOrDefault();
103+
104+
if (item != null)
105+
{
106+
var placeholder = item.ViewModel.Thread.Comments.Last();
107+
placeholder.CancelEdit.Take(1).Subscribe(_ => session.Dismiss());
108+
}
109+
100110
return trackingPoint;
101111
}
102112

0 commit comments

Comments
 (0)