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

Commit 8709555

Browse files
authored
Merge branch 'master' into fixes/1241-carriage-return-in-diff
2 parents 095d62c + a9ddfd0 commit 8709555

File tree

50 files changed

+718
-487
lines changed

Some content is hidden

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

50 files changed

+718
-487
lines changed

src/GitHub.App/GitHub.App.csproj

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" />
3+
<Import Project="..\..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props')" />
44
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
55
<PropertyGroup>
66
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -47,8 +47,8 @@
4747
</PropertyGroup>
4848
<Import Project="$(SolutionDir)\src\common\signing.props" />
4949
<ItemGroup>
50-
<Reference Include="LibGit2Sharp, Version=0.22.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
51-
<HintPath>..\..\packages\LibGit2Sharp.0.22.0\lib\net40\LibGit2Sharp.dll</HintPath>
50+
<Reference Include="LibGit2Sharp, Version=0.24.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
51+
<HintPath>..\..\packages\LibGit2Sharp.0.24.0\lib\net40\LibGit2Sharp.dll</HintPath>
5252
<Private>True</Private>
5353
</Reference>
5454
<Reference Include="Microsoft.VisualStudio.ComponentModelHost, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -238,7 +238,9 @@
238238
</ItemGroup>
239239
<ItemGroup>
240240
<None Include="app.config" />
241-
<None Include="packages.config" />
241+
<None Include="packages.config">
242+
<SubType>Designer</SubType>
243+
</None>
242244
</ItemGroup>
243245
<ItemGroup>
244246
<ProjectReference Include="..\..\submodules\akavache\Akavache.Sqlite3\Akavache.Sqlite3.csproj">
@@ -309,7 +311,7 @@
309311
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
310312
</PropertyGroup>
311313
<Error Condition="!Exists('..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets'))" />
312-
<Error Condition="!Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props'))" />
314+
<Error Condition="!Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props'))" />
313315
</Target>
314316
<Import Project="..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets" Condition="Exists('..\..\packages\SQLitePCL.raw_basic.0.7.3.0-vs2012\build\net45\SQLitePCL.raw_basic.targets')" />
315317
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

src/GitHub.App/Services/GitClient.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public Task Pull(IRepository repository)
4343
return Task.Factory.StartNew(() =>
4444
{
4545
var signature = repository.Config.BuildSignature(DateTimeOffset.UtcNow);
46+
#pragma warning disable 0618 // TODO: Replace `Network.Pull` with `Commands.Pull`.
4647
repository.Network.Pull(signature, pullOptions);
48+
#pragma warning restore 0618
4749
});
4850
}
4951

@@ -74,7 +76,9 @@ public Task Fetch(IRepository repository, string remoteName)
7476
try
7577
{
7678
var remote = repository.Network.Remotes[remoteName];
79+
#pragma warning disable 0618 // TODO: Replace `Network.Fetch` with `Commands.Fetch`.
7780
repository.Network.Fetch(remote, fetchOptions);
81+
#pragma warning restore 0618
7882
}
7983
catch (Exception ex)
8084
{
@@ -104,7 +108,9 @@ public Task Fetch(IRepository repo, UriString cloneUrl, params string[] refspecs
104108
var remote = repo.Network.Remotes.Add(tempRemoteName, httpsUrl);
105109
try
106110
{
111+
#pragma warning disable 0618 // TODO: Replace `Network.Fetch` with `Commands.Fetch`.
107112
repo.Network.Fetch(remote, refspecs, fetchOptions);
113+
#pragma warning restore 0618
108114
}
109115
finally
110116
{
@@ -131,7 +137,9 @@ public Task Fetch(IRepository repository, string remoteName, params string[] ref
131137
try
132138
{
133139
var remote = repository.Network.Remotes[remoteName];
140+
#pragma warning disable 0618 // TODO: Replace `Network.Fetch` with `Commands.Fetch`.
134141
repository.Network.Fetch(remote, refspecs, fetchOptions);
142+
#pragma warning restore 0618
135143
}
136144
catch (Exception ex)
137145
{
@@ -150,7 +158,9 @@ public Task Checkout(IRepository repository, string branchName)
150158

151159
return Task.Factory.StartNew(() =>
152160
{
161+
#pragma warning disable 0618 // TODO: Replace `IRepository.Checkout` with `Commands.Checkout`.
153162
repository.Checkout(branchName);
163+
#pragma warning restore 0618
154164
});
155165
}
156166

src/GitHub.App/Services/PullRequestService.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ public IObservable<Unit> Push(ILocalRepositoryModel repository)
106106
return Observable.Defer(async () =>
107107
{
108108
var repo = gitService.GetRepository(repository.LocalPath);
109-
var remote = await gitClient.GetHttpRemote(repo, repo.Head.Remote.Name);
109+
var remoteName = repo.Head.RemoteName;
110+
var remote = await gitClient.GetHttpRemote(repo, remoteName);
110111
return gitClient.Push(repo, repo.Head.TrackedBranch.UpstreamBranchCanonicalName, remote.Name).ToObservable();
111112
});
112113
}
@@ -170,10 +171,10 @@ public IObservable<BranchTrackingDetails> CalculateHistoryDivergence(ILocalRepos
170171
return Observable.Defer(async () =>
171172
{
172173
var repo = gitService.GetRepository(repository.LocalPath);
173-
174-
if (repo.Head.Remote != null)
174+
var remoteName = repo.Head.RemoteName;
175+
if (remoteName != null)
175176
{
176-
var remote = await gitClient.GetHttpRemote(repo, repo.Head.Remote.Name);
177+
var remote = await gitClient.GetHttpRemote(repo, remoteName);
177178
await gitClient.Fetch(repo, remote.Name);
178179
}
179180

@@ -368,8 +369,8 @@ public IObservable<Unit> RemoveUnusedRemotes(ILocalRepositoryModel repository)
368369
var repo = gitService.GetRepository(repository.LocalPath);
369370
var usedRemotes = new HashSet<string>(
370371
repo.Branches
371-
.Where(x => !x.IsRemote && x.Remote != null)
372-
.Select(x => x.Remote?.Name));
372+
.Where(x => !x.IsRemote && x.RemoteName != null)
373+
.Select(x => x.RemoteName));
373374

374375
foreach (var remote in repo.Network.Remotes)
375376
{

src/GitHub.App/packages.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="LibGit2Sharp" version="0.22.0" targetFramework="net461" />
4-
<package id="LibGit2Sharp.NativeBinaries" version="1.0.129" targetFramework="net461" />
3+
<package id="LibGit2Sharp" version="0.24.0" targetFramework="net461" />
4+
<package id="LibGit2Sharp.NativeBinaries" version="1.0.185" targetFramework="net461" />
55
<package id="Microsoft.VisualStudio.Shell.14.0" version="14.3.25407" targetFramework="net461" />
66
<package id="Microsoft.VisualStudio.Shell.Immutable.10.0" version="10.0.30319" targetFramework="net461" />
77
<package id="Microsoft.VisualStudio.TextManager.Interop" version="7.10.6070" targetFramework="net461" />

src/GitHub.Exports.Reactive/GitHub.Exports.Reactive.csproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" />
3+
<Import Project="..\..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props')" />
44
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
55
<PropertyGroup>
66
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -42,8 +42,8 @@
4242
</PropertyGroup>
4343
<Import Project="$(SolutionDir)\src\common\signing.props" />
4444
<ItemGroup>
45-
<Reference Include="LibGit2Sharp, Version=0.22.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
46-
<HintPath>..\..\packages\LibGit2Sharp.0.22.0\lib\net40\LibGit2Sharp.dll</HintPath>
45+
<Reference Include="LibGit2Sharp, Version=0.24.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
46+
<HintPath>..\..\packages\LibGit2Sharp.0.24.0\lib\net40\LibGit2Sharp.dll</HintPath>
4747
<Private>True</Private>
4848
</Reference>
4949
<Reference Include="Microsoft.VisualStudio.CoreUtility, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -104,7 +104,6 @@
104104
<Compile Include="Models\IAvatarContainer.cs" />
105105
<Compile Include="Models\IConnectionRepositoryHostMap.cs" />
106106
<Compile Include="Models\IInlineCommentThreadModel.cs" />
107-
<Compile Include="Models\IPullRequestSessionLiveFile.cs" />
108107
<Compile Include="Models\IPullRequestSessionFile.cs" />
109108
<Compile Include="Models\IRepositoryHosts.cs" />
110109
<Compile Include="Models\PullRequestTextBufferInfo.cs" />
@@ -206,7 +205,7 @@
206205
<PropertyGroup>
207206
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
208207
</PropertyGroup>
209-
<Error Condition="!Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props'))" />
208+
<Error Condition="!Exists('..\..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props'))" />
210209
</Target>
211210
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
212211
Other similar extension points exist, see Microsoft.Common.targets.

src/GitHub.Exports.Reactive/Models/IPullRequestSessionFile.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
namespace GitHub.Models
66
{
7+
public enum DiffSide
8+
{
9+
Right,
10+
Left,
11+
}
12+
713
/// <summary>
814
/// Represents a file in a pull request.
915
/// </summary>
@@ -41,5 +47,11 @@ public interface IPullRequestSessionFile : INotifyPropertyChanged
4147
/// Gets the inline comments threads for the file.
4248
/// </summary>
4349
IReadOnlyList<IInlineCommentThreadModel> InlineCommentThreads { get; }
50+
51+
/// <summary>
52+
/// Gets an observable that is raised with a collection of 0-based line numbers when the
53+
/// review comments on the file are changed.
54+
/// </summary>
55+
IObservable<IReadOnlyList<Tuple<int, DiffSide>>> LinesChanged { get; }
4456
}
4557
}

src/GitHub.Exports.Reactive/Models/IPullRequestSessionLiveFile.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/GitHub.Exports.Reactive/Models/PullRequestTextBufferInfo.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@ public class PullRequestTextBufferInfo
1515
/// </summary>
1616
/// <param name="session">The pull request session.</param>
1717
/// <param name="relativePath">The relative path to the file in the repository.</param>
18-
/// <param name="isLeftComparisonBuffer">
19-
/// Whether the buffer represents the left-hand-side of a comparison.
20-
/// </param>
18+
/// <param name="side">Which side of a diff comparision the buffer represents.</param>
2119
public PullRequestTextBufferInfo(
2220
IPullRequestSession session,
2321
string relativePath,
24-
bool isLeftComparisonBuffer)
22+
DiffSide? side)
2523
{
2624
Session = session;
2725
RelativePath = relativePath;
28-
IsLeftComparisonBuffer = isLeftComparisonBuffer;
26+
Side = side;
2927
}
3028

3129
/// <summary>
@@ -39,8 +37,8 @@ public PullRequestTextBufferInfo(
3937
public string RelativePath { get; }
4038

4139
/// <summary>
42-
/// Gets a value indicating whether the buffer represents the left-hand-side of a comparison.
40+
/// Gets a value indicating which side of a diff comparision the buffer represents.
4341
/// </summary>
44-
public bool IsLeftComparisonBuffer { get; }
42+
public DiffSide? Side { get; }
4543
}
4644
}

src/GitHub.Exports.Reactive/Services/IPullRequestSession.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ public interface IPullRequestSession
2525
/// </summary>
2626
IPullRequestModel PullRequest { get; }
2727

28+
/// <summary>
29+
/// Gets an observable that indicates that<see cref="PullRequest"/> has been updated.
30+
/// </summary>
31+
/// <remarks>
32+
/// This notification is different to listening for a PropertyChanged event because the
33+
/// pull request model may be updated in-place which will not result in a PropertyChanged
34+
/// notification.
35+
/// </remarks>
36+
IObservable<IPullRequestModel> PullRequestChanged { get; }
37+
2838
/// <summary>
2939
/// Gets the local repository.
3040
/// </summary>

src/GitHub.Exports.Reactive/Services/IPullRequestSessionManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public interface IPullRequestSessionManager : INotifyPropertyChanged
3838
/// <param name="textView">The text view that is showing the file.</param>
3939
/// <param name="textBuffer">The text buffer with the file contents.</param>
4040
/// <returns>An <see cref="IPullRequestSessionLiveFile"/>.</returns>
41-
Task<IPullRequestSessionLiveFile> GetLiveFile(
41+
Task<IPullRequestSessionFile> GetLiveFile(
4242
string relativePath,
4343
ITextView textView,
4444
ITextBuffer textBuffer);

0 commit comments

Comments
 (0)