From 1231b794b1d1c32b94bfdcf0d355d38b9aae75ce Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Tue, 18 Feb 2014 20:20:37 +1100 Subject: [PATCH] bugfix for PR commits having different shape to regular commits --- .../Clients/IObservablePullRequestsClient.cs | 4 ++-- .../Clients/ObservablePullRequestsClient.cs | 6 +++--- .../Clients/PullRequestsClientTests.cs | 2 +- Octokit/Clients/IPullRequestsClient.cs | 4 ++-- Octokit/Clients/PullRequestsClient.cs | 6 +++--- Octokit/Models/Response/PullRequestCommit.cs | 17 +++++++++++++++++ Octokit/Octokit-Mono.csproj | 1 + Octokit/Octokit-MonoAndroid.csproj | 1 + Octokit/Octokit-Monotouch.csproj | 1 + Octokit/Octokit-netcore45.csproj | 1 + Octokit/Octokit.csproj | 1 + 11 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 Octokit/Models/Response/PullRequestCommit.cs diff --git a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs index 4d49adbd..739793c8 100644 --- a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs +++ b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs @@ -89,7 +89,7 @@ namespace Octokit.Reactive /// The owner of the repository /// The name of the repository /// The pull request number - /// A collection of results - IObservable Commits(string owner, string name, int number); + /// A collection of results + IObservable Commits(string owner, string name, int number); } } diff --git a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs index 343a70a6..6332b675 100644 --- a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs +++ b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs @@ -143,13 +143,13 @@ namespace Octokit.Reactive /// The owner of the repository /// The name of the repository /// The pull request number - /// A collection of results - public IObservable Commits(string owner, string name, int number) + /// A collection of results + public IObservable Commits(string owner, string name, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return _connection.GetAndFlattenAllPages(ApiUrls.PullRequestCommits(owner, name, number)); + return _connection.GetAndFlattenAllPages(ApiUrls.PullRequestCommits(owner, name, number)); } } } \ No newline at end of file diff --git a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs index dae62633..acd63cf4 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs @@ -183,7 +183,7 @@ public class PullRequestsClientTests : IDisposable var result = await _fixture.Commits(Helper.UserName, _repository.Name, pullRequest.Number); Assert.Equal(1, result.Count); - Assert.Equal("this is the commit to merge into the pull request", result[0].Message); + Assert.Equal("this is the commit to merge into the pull request", result[0].Commit.Message); } async Task CreateTheWorld() diff --git a/Octokit/Clients/IPullRequestsClient.cs b/Octokit/Clients/IPullRequestsClient.cs index 29211f06..0c0b5fc6 100644 --- a/Octokit/Clients/IPullRequestsClient.cs +++ b/Octokit/Clients/IPullRequestsClient.cs @@ -90,7 +90,7 @@ namespace Octokit /// The owner of the repository /// The name of the repository /// The pull request number - /// A of s which are part of this pull request - Task> Commits(string owner, string name, int number); + /// A of s which are part of this pull request + Task> Commits(string owner, string name, int number); } } diff --git a/Octokit/Clients/PullRequestsClient.cs b/Octokit/Clients/PullRequestsClient.cs index 1fc23ed6..53e8e010 100644 --- a/Octokit/Clients/PullRequestsClient.cs +++ b/Octokit/Clients/PullRequestsClient.cs @@ -151,13 +151,13 @@ namespace Octokit /// The owner of the repository /// The name of the repository /// The pull request number - /// A of s which are part of this pull request - public Task> Commits(string owner, string name, int number) + /// A of s which are part of this pull request + public Task> Commits(string owner, string name, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return ApiConnection.GetAll(ApiUrls.PullRequestCommits(owner, name, number)); + return ApiConnection.GetAll(ApiUrls.PullRequestCommits(owner, name, number)); } } } diff --git a/Octokit/Models/Response/PullRequestCommit.cs b/Octokit/Models/Response/PullRequestCommit.cs new file mode 100644 index 00000000..6aa7e635 --- /dev/null +++ b/Octokit/Models/Response/PullRequestCommit.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace Octokit +{ + public class PullRequestCommit + { + public Signature Author { get; set; } + public Uri CommentsUrl { get; set; } + public Commit Commit { get; set; } + public Signature Committer { get; set; } + public Uri HtmlUrl { get; set; } + public IEnumerable Parents { get; set; } + public string Sha { get; set; } + public Uri Url { get; set; } + } +} \ No newline at end of file diff --git a/Octokit/Octokit-Mono.csproj b/Octokit/Octokit-Mono.csproj index fc40f7e5..4138f69e 100644 --- a/Octokit/Octokit-Mono.csproj +++ b/Octokit/Octokit-Mono.csproj @@ -289,6 +289,7 @@ + \ No newline at end of file diff --git a/Octokit/Octokit-MonoAndroid.csproj b/Octokit/Octokit-MonoAndroid.csproj index 43e61c1d..ee745174 100644 --- a/Octokit/Octokit-MonoAndroid.csproj +++ b/Octokit/Octokit-MonoAndroid.csproj @@ -300,6 +300,7 @@ + \ No newline at end of file diff --git a/Octokit/Octokit-Monotouch.csproj b/Octokit/Octokit-Monotouch.csproj index e1c121d9..565a94f1 100644 --- a/Octokit/Octokit-Monotouch.csproj +++ b/Octokit/Octokit-Monotouch.csproj @@ -295,6 +295,7 @@ + \ No newline at end of file diff --git a/Octokit/Octokit-netcore45.csproj b/Octokit/Octokit-netcore45.csproj index df228239..3c2dea09 100644 --- a/Octokit/Octokit-netcore45.csproj +++ b/Octokit/Octokit-netcore45.csproj @@ -287,6 +287,7 @@ + diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index ff88d6c0..dd62f718 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -131,6 +131,7 @@ +