From 67bb3f8d967ff9d5cdc82074debb72fe3f6d76e5 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sun, 25 Feb 2018 03:15:03 -0500 Subject: [PATCH 01/11] Adds MaintainerCanModify to PullRequest --- Octokit/Models/Response/PullRequest.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Octokit/Models/Response/PullRequest.cs b/Octokit/Models/Response/PullRequest.cs index 56b517e81a..1f6aa58103 100644 --- a/Octokit/Models/Response/PullRequest.cs +++ b/Octokit/Models/Response/PullRequest.cs @@ -16,7 +16,7 @@ public PullRequest(int number) Number = number; } - public PullRequest(long id, string url, string htmlUrl, string diffUrl, string patchUrl, string issueUrl, string statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, IReadOnlyList assignees, bool? mergeable, MergeableState? mergeableState, User mergedBy, string mergeCommitSha, int comments, int commits, int additions, int deletions, int changedFiles, Milestone milestone, bool locked, IReadOnlyList requestedReviewers) + public PullRequest(long id, string url, string htmlUrl, string diffUrl, string patchUrl, string issueUrl, string statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, IReadOnlyList assignees, bool? mergeable, MergeableState? mergeableState, User mergedBy, string mergeCommitSha, int comments, int commits, int additions, int deletions, int changedFiles, Milestone milestone, bool locked, bool maintainerCanModify, IReadOnlyList requestedReviewers) { Id = id; Url = url; @@ -49,6 +49,7 @@ public PullRequest(long id, string url, string htmlUrl, string diffUrl, string p ChangedFiles = changedFiles; Milestone = milestone; Locked = locked; + MaintainerCanModify = maintainerCanModify; RequestedReviewers = requestedReviewers; } @@ -219,6 +220,11 @@ public bool Merged /// public bool Locked { get; protected set; } + /// + /// If users with write access to the base repository can push to the HEAD branch + /// + public bool MaintainerCanModify { get; protected set; } + /// /// Users requested for review /// From ea59264a0e11d918d45fe5b05c405c037ab0bac2 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sun, 25 Feb 2018 23:18:28 -0500 Subject: [PATCH 02/11] Make MaintainerCanModify nullable --- Octokit/Models/Response/PullRequest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Octokit/Models/Response/PullRequest.cs b/Octokit/Models/Response/PullRequest.cs index 1f6aa58103..d17623b4f0 100644 --- a/Octokit/Models/Response/PullRequest.cs +++ b/Octokit/Models/Response/PullRequest.cs @@ -16,7 +16,7 @@ public PullRequest(int number) Number = number; } - public PullRequest(long id, string url, string htmlUrl, string diffUrl, string patchUrl, string issueUrl, string statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, IReadOnlyList assignees, bool? mergeable, MergeableState? mergeableState, User mergedBy, string mergeCommitSha, int comments, int commits, int additions, int deletions, int changedFiles, Milestone milestone, bool locked, bool maintainerCanModify, IReadOnlyList requestedReviewers) + public PullRequest(long id, string url, string htmlUrl, string diffUrl, string patchUrl, string issueUrl, string statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, IReadOnlyList assignees, bool? mergeable, MergeableState? mergeableState, User mergedBy, string mergeCommitSha, int comments, int commits, int additions, int deletions, int changedFiles, Milestone milestone, bool locked, bool? maintainerCanModify, IReadOnlyList requestedReviewers) { Id = id; Url = url; @@ -223,7 +223,7 @@ public bool Merged /// /// If users with write access to the base repository can push to the HEAD branch /// - public bool MaintainerCanModify { get; protected set; } + public bool? MaintainerCanModify { get; protected set; } /// /// Users requested for review From 901859e4c88e21736da523ae4e87b2cad9cc2f4f Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sun, 25 Feb 2018 23:19:16 -0500 Subject: [PATCH 03/11] Tweak MaintainerCanModify doc comment --- Octokit/Models/Response/PullRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit/Models/Response/PullRequest.cs b/Octokit/Models/Response/PullRequest.cs index d17623b4f0..51aa95da94 100644 --- a/Octokit/Models/Response/PullRequest.cs +++ b/Octokit/Models/Response/PullRequest.cs @@ -221,7 +221,7 @@ public bool Merged public bool Locked { get; protected set; } /// - /// If users with write access to the base repository can push to the HEAD branch + /// Whether maintainers of the base repository can push to the HEAD branch /// public bool? MaintainerCanModify { get; protected set; } From 2cb4e5f59389fdf2be2a9c18a3019f4720941293 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 26 Feb 2018 17:00:02 -0500 Subject: [PATCH 04/11] Add MaintainerCanModify to NewPullRequest --- Octokit/Models/Request/NewPullRequest.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Octokit/Models/Request/NewPullRequest.cs b/Octokit/Models/Request/NewPullRequest.cs index e4323ba804..83a14220b0 100644 --- a/Octokit/Models/Request/NewPullRequest.cs +++ b/Octokit/Models/Request/NewPullRequest.cs @@ -9,13 +9,14 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class NewPullRequest { - /// - /// Initializes a new instance of the class. - /// - /// The title of the pull request. - /// The branch (or git ref where your changes are implemented. In other words, the source branch/ref - /// The base (or git ref) reference you want your changes pulled into. In other words, the target branch/ref - public NewPullRequest(string title, string head, string baseRef) + /// + /// Initializes a new instance of the class. + /// + /// The title of the pull request. + /// The branch (or git ref where your changes are implemented. In other words, the source branch/ref + /// The base (or git ref) reference you want your changes pulled into. In other words, the target branch/ref + /// Whether maintainers of the base repository can push to if it is a branch + public NewPullRequest(string title, string head, string baseRef, bool maintainerCanModify) { Ensure.ArgumentNotNullOrEmptyString(title, "title"); Ensure.ArgumentNotNullOrEmptyString(head, "head"); @@ -24,6 +25,7 @@ public NewPullRequest(string title, string head, string baseRef) Title = title; Head = head; Base = baseRef; + MaintainerCanModify = maintainerCanModify; } /// @@ -41,6 +43,11 @@ public NewPullRequest(string title, string head, string baseRef) /// public string Head { get; private set; } + /// + /// Whether maintainers of the base repository can push to if it is a branch + /// + public bool MaintainerCanModify { get; private set; } + /// /// Body of the pull request (optional) /// From 8276b1efa07a984636d44585045ff73aeb10321e Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 27 Feb 2018 09:23:56 -0500 Subject: [PATCH 05/11] Add MaintainerCanModify to PullRequestUpdate --- Octokit/Models/Request/PullRequestUpdate.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Octokit/Models/Request/PullRequestUpdate.cs b/Octokit/Models/Request/PullRequestUpdate.cs index 268e171ced..7beeac0d49 100644 --- a/Octokit/Models/Request/PullRequestUpdate.cs +++ b/Octokit/Models/Request/PullRequestUpdate.cs @@ -29,7 +29,12 @@ public class PullRequestUpdate /// public string Base { get; set; } - internal string DebuggerDisplay + /// + /// Whether maintainers of the base repository can push to if it is a branch + /// + public bool MaintainerCanModify { get; set; } + + internal string DebuggerDisplay { get { From f20dfa7d0efc5ed18b7d622a0eb9b5d1f578f9a5 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 27 Feb 2018 09:30:15 -0500 Subject: [PATCH 06/11] Update NewPulRequest tests --- ...equestReviewCommentReactionsClientTests.cs | 2 +- .../PullRequestReviewCommentsClientTests.cs | 2 +- .../PullRequestReviewRequestsClientTests.cs | 2 +- .../Clients/PullRequestsClientTests.cs | 110 +++++++++--------- .../Helpers/RepositorySetupHelper.cs | 2 +- .../Clients/PullRequestsClientTests.cs | 20 ++-- .../ObservablePullRequestsClientTests.cs | 12 +- 7 files changed, 76 insertions(+), 74 deletions(-) diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs index 4044adde88..65b84a1609 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs @@ -146,7 +146,7 @@ async Task CreatePullRequest(RepositoryContext context) // Creating a pull request - var pullRequest = new NewPullRequest("Nice title for the pull request", branchName, "master"); + var pullRequest = new NewPullRequest("Nice title for the pull request", branchName, "master", false); var createdPullRequest = await _github.PullRequest.Create(Helper.UserName, repoName, pullRequest); var data = new PullRequestData diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs index ad51225dbe..a62f45106d 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs @@ -870,7 +870,7 @@ async Task CreatePullRequest(RepositoryContext context, string // Creating a pull request - var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master"); + var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master", false); var createdPullRequest = await _github.PullRequest.Create(Helper.UserName, repoName, pullRequest); var data = new PullRequestData diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewRequestsClientTests.cs index b139b3b145..c14915dd96 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewRequestsClientTests.cs @@ -244,7 +244,7 @@ static async Task CreateTheWorld(IGitHubClient github, RepositoryContext co await github.Git.Reference.Create(context.RepositoryOwner, context.RepositoryName, new NewReference("refs/heads/my-branch", featureBranchCommit2.Sha)); // create a pull request - var pullRequest = new NewPullRequest("Nice title for the pull request", "my-branch", "master"); + var pullRequest = new NewPullRequest("Nice title for the pull request", "my-branch", "master", false); var createdPullRequest = await github.PullRequest.Create(context.RepositoryOwner, context.RepositoryName, pullRequest); // Create review requests (optional) diff --git a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs index 9afd3ae656..9be4e8cc03 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs @@ -32,7 +32,7 @@ public async Task CanCreate() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); Assert.Equal("a pull request", result.Title); } @@ -42,7 +42,7 @@ public async Task CanCreateWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(_context.Repository.Id, newPullRequest); Assert.Equal("a pull request", result.Title); } @@ -52,7 +52,7 @@ public async Task CanGetForRepository() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName); @@ -67,7 +67,7 @@ public async Task CanGetForRepositoryWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id); @@ -81,7 +81,7 @@ public async Task CanGetWithAssigneesForRepository() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); // Add an assignee @@ -104,7 +104,7 @@ public async Task CanGetWithAssigneesForRepositoryWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(_context.Repository.Id, newPullRequest); // Add an assignee @@ -127,7 +127,7 @@ public async Task ReturnsCorrectCountOfPullRequestsWithoutStart() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var options = new ApiOptions @@ -147,7 +147,7 @@ public async Task ReturnsCorrectCountOfPullRequestsWithoutStartWithRepositoryId( { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var options = new ApiOptions @@ -167,8 +167,8 @@ public async Task ReturnsCorrectCountOfPullRequestsWithStart() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -190,8 +190,8 @@ public async Task ReturnsCorrectCountOfPullRequestsWithStartWithRepositoryId() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -213,8 +213,8 @@ public async Task ReturnsDistinctPullRequestsBasedOnStartPage() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -243,8 +243,8 @@ public async Task ReturnsDistinctPullRequestsBasedOnStartPageWithRepositoryId() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -273,7 +273,7 @@ public async Task CanGetOpenPullRequest() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", true); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; @@ -281,6 +281,7 @@ public async Task CanGetOpenPullRequest() Assert.Equal(1, pullRequests.Count); Assert.Equal(result.Title, pullRequests[0].Title); + Assert.Equal(true, pullRequests[0].MaintainerCanModify); } [IntegrationTest] @@ -288,7 +289,7 @@ public async Task CanGetOpenPullRequestWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; @@ -296,6 +297,7 @@ public async Task CanGetOpenPullRequestWithRepositoryId() Assert.Equal(1, pullRequests.Count); Assert.Equal(result.Title, pullRequests[0].Title); + Assert.Equal(false, pullRequests[0].MaintainerCanModify); } [IntegrationTest] @@ -303,7 +305,7 @@ public async Task ReturnsCorrectCountOfPullRequestsWithoutStartParameterized() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var options = new ApiOptions @@ -324,7 +326,7 @@ public async Task ReturnsCorrectCountOfPullRequestsWithoutStartParameterizedWith { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var options = new ApiOptions @@ -345,8 +347,8 @@ public async Task ReturnsCorrectCountOfPullRequestsWithStartParameterized() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -369,8 +371,8 @@ public async Task ReturnsCorrectCountOfPullRequestsWithStartParameterizedWithRep { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -393,8 +395,8 @@ public async Task ReturnsDistinctPullRequestsBasedOnStartPageParameterized() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -425,8 +427,8 @@ public async Task ReturnsDistinctPullRequestsBasedOnStartPageParameterizedWithRe { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -457,7 +459,7 @@ public async Task IgnoresOpenPullRequest() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Closed }; @@ -471,7 +473,7 @@ public async Task IgnoresOpenPullRequestWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Closed }; @@ -485,7 +487,7 @@ public async Task CanUpdate() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var updatePullRequest = new PullRequestUpdate { Title = "updated title", Body = "Hello New Body", Base = "my-other-branch" }; @@ -501,7 +503,7 @@ public async Task CanUpdateWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var updatePullRequest = new PullRequestUpdate { Title = "updated title", Body = "Hello New Body", Base = "my-other-branch" }; @@ -517,7 +519,7 @@ public async Task CanClose() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var updatePullRequest = new PullRequestUpdate { State = ItemState.Closed }; @@ -533,7 +535,7 @@ public async Task CanFindClosedPullRequest() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var updatePullRequest = new PullRequestUpdate { State = ItemState.Closed }; @@ -550,10 +552,10 @@ public async Task CanSortPullRequests() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); - var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master"); + var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master", false); var anotherPullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); var updatePullRequest = new PullRequestUpdate { Body = "This is the body" }; @@ -573,10 +575,10 @@ public async Task CanSpecifyDirectionOfSort() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); - var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master"); + var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master", false); var anotherPullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, new PullRequestRequest { SortDirection = SortDirection.Ascending }); @@ -591,7 +593,7 @@ public async Task IsNotMergedInitially() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var result = await _fixture.Merged(Helper.UserName, _context.RepositoryName, pullRequest.Number); @@ -604,7 +606,7 @@ public async Task IsNotMergedInitiallyWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var result = await _fixture.Merged(_context.Repository.Id, pullRequest.Number); @@ -617,7 +619,7 @@ public async Task CanBeMerged() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "thing the thing" }; @@ -631,7 +633,7 @@ public async Task CanBeMergedWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "thing the thing" }; @@ -645,7 +647,7 @@ public async Task CanBeMergedWithNoOptionalInput() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest(); @@ -659,7 +661,7 @@ public async Task CanBeMergedWithShaSpecified() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "thing the thing", Sha = pullRequest.Head.Sha }; @@ -673,7 +675,7 @@ public async Task CanBeMergedWithMergeMethod() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "fake commit message", CommitTitle = "fake title", MergeMethod = PullRequestMergeMethod.Merge }; @@ -689,7 +691,7 @@ public async Task CanBeMergedWithSquashMethod() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "fake commit message", CommitTitle = "fake title", MergeMethod = PullRequestMergeMethod.Squash }; @@ -705,7 +707,7 @@ public async Task CanBeMergedWithRebaseMethod() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "fake commit message", CommitTitle = "fake title", MergeMethod = PullRequestMergeMethod.Rebase }; @@ -722,7 +724,7 @@ public async Task CannotBeMergedDueMismatchConflict() await CreateTheWorld(); var fakeSha = new string('f', 40); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { Sha = fakeSha }; @@ -741,7 +743,7 @@ public async Task CannotBeMergedDueNotInMergeableState() var masterCommit = await CreateCommit("Commit in master", newMasterTree.Sha, master.Object.Sha); await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(masterCommit.Sha)); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); await Task.Delay(TimeSpan.FromSeconds(5)); @@ -762,7 +764,7 @@ public async Task UpdatesMaster() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "thing the thing" }; @@ -778,7 +780,7 @@ public async Task CanBrowseCommits() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var result = await _fixture.Commits(Helper.UserName, _context.RepositoryName, pullRequest.Number); @@ -792,7 +794,7 @@ public async Task CanBrowseCommitsWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var result = await _fixture.Commits(_context.Repository.Id, pullRequest.Number); @@ -806,7 +808,7 @@ public async Task CanGetCommitsAndCommentCount() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); // create new commit for branch @@ -838,7 +840,7 @@ public async Task CanGetCommitsAndCommentCountWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); // create new commit for branch diff --git a/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs b/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs index 3bfa7f4d02..b4e8190028 100644 --- a/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs +++ b/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs @@ -63,7 +63,7 @@ public static async Task CreateTheWorld(this IGitHubClient client, Re public static async Task CreatePullRequest(this IGitHubClient client, Repository repository, string branch = "my-branch") { - var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master"); + var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master", false); var createdPullRequest = await client.PullRequest.Create(repository.Owner.Login, repository.Name, pullRequest); return createdPullRequest; diff --git a/Octokit.Tests/Clients/PullRequestsClientTests.cs b/Octokit.Tests/Clients/PullRequestsClientTests.cs index f30d2e89ca..16a07f9241 100644 --- a/Octokit.Tests/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests/Clients/PullRequestsClientTests.cs @@ -236,7 +236,7 @@ public class TheCreateMethod [Fact] public async Task PostsToCorrectUrl() { - var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name"); + var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false); var connection = Substitute.For(); var client = new PullRequestsClient(connection); @@ -249,7 +249,7 @@ public async Task PostsToCorrectUrl() [Fact] public async Task PostsToCorrectUrlWithRepositoryId() { - var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name"); + var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false); var connection = Substitute.For(); var client = new PullRequestsClient(connection); @@ -265,14 +265,14 @@ public async Task EnsuresNonNullArguments() var connection = Substitute.For(); var client = new PullRequestsClient(connection); - await Assert.ThrowsAsync(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2"))); - await Assert.ThrowsAsync(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2"))); + await Assert.ThrowsAsync(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2", false))); + await Assert.ThrowsAsync(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2", false))); await Assert.ThrowsAsync(() => client.Create("owner", "name", null)); await Assert.ThrowsAsync(() => client.Create(1, null)); - await Assert.ThrowsAsync(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2"))); - await Assert.ThrowsAsync(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2"))); + await Assert.ThrowsAsync(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2", false))); + await Assert.ThrowsAsync(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2", false))); } } @@ -310,14 +310,14 @@ public async Task EnsuresNonNullArguments() var connection = Substitute.For(); var client = new PullRequestsClient(connection); - await Assert.ThrowsAsync(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2"))); - await Assert.ThrowsAsync(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2"))); + await Assert.ThrowsAsync(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2", false))); + await Assert.ThrowsAsync(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2", false))); await Assert.ThrowsAsync(() => client.Create("owner", "name", null)); await Assert.ThrowsAsync(() => client.Create(1, null)); - await Assert.ThrowsAsync(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2"))); - await Assert.ThrowsAsync(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2"))); + await Assert.ThrowsAsync(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2", false))); + await Assert.ThrowsAsync(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2", false))); } } diff --git a/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs index 8ca0e56061..2e22b0e01b 100644 --- a/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs @@ -462,7 +462,7 @@ public class TheCreateMethod [Fact] public void CreatesFromClientRepositoryPullRequest() { - var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name"); + var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false); var gitHubClient = Substitute.For(); var client = new ObservablePullRequestsClient(gitHubClient); @@ -474,7 +474,7 @@ public void CreatesFromClientRepositoryPullRequest() [Fact] public void CreatesFromClientRepositoryPullRequestWithRepositoryId() { - var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name"); + var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false); var gitHubClient = Substitute.For(); var client = new ObservablePullRequestsClient(gitHubClient); @@ -489,14 +489,14 @@ public void EnsuresNonNullArguments() var gitHubClient = Substitute.For(); var client = new ObservablePullRequestsClient(gitHubClient); - Assert.Throws(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2"))); - Assert.Throws(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2"))); + Assert.Throws(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2", false))); + Assert.Throws(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2", false))); Assert.Throws(() => client.Create("owner", "name", null)); Assert.Throws(() => client.Create(1, null)); - Assert.Throws(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2"))); - Assert.Throws(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2"))); + Assert.Throws(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2", false))); + Assert.Throws(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2", false))); } } From 6d72c425bcba5fdddcac106f6dc6b7f284d94a66 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 27 Feb 2018 09:32:19 -0500 Subject: [PATCH 07/11] Convert tabs to spaces --- Octokit/Models/Request/NewPullRequest.cs | 26 ++++++++++----------- Octokit/Models/Request/PullRequestUpdate.cs | 10 ++++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Octokit/Models/Request/NewPullRequest.cs b/Octokit/Models/Request/NewPullRequest.cs index 83a14220b0..0622d51ad3 100644 --- a/Octokit/Models/Request/NewPullRequest.cs +++ b/Octokit/Models/Request/NewPullRequest.cs @@ -9,14 +9,14 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class NewPullRequest { - /// - /// Initializes a new instance of the class. - /// - /// The title of the pull request. - /// The branch (or git ref where your changes are implemented. In other words, the source branch/ref - /// The base (or git ref) reference you want your changes pulled into. In other words, the target branch/ref - /// Whether maintainers of the base repository can push to if it is a branch - public NewPullRequest(string title, string head, string baseRef, bool maintainerCanModify) + /// + /// Initializes a new instance of the class. + /// + /// The title of the pull request. + /// The branch (or git ref where your changes are implemented. In other words, the source branch/ref + /// The base (or git ref) reference you want your changes pulled into. In other words, the target branch/ref + /// Whether maintainers of the base repository can push to if it is a branch + public NewPullRequest(string title, string head, string baseRef, bool maintainerCanModify) { Ensure.ArgumentNotNullOrEmptyString(title, "title"); Ensure.ArgumentNotNullOrEmptyString(head, "head"); @@ -25,7 +25,7 @@ public NewPullRequest(string title, string head, string baseRef, bool maintainer Title = title; Head = head; Base = baseRef; - MaintainerCanModify = maintainerCanModify; + MaintainerCanModify = maintainerCanModify; } /// @@ -43,10 +43,10 @@ public NewPullRequest(string title, string head, string baseRef, bool maintainer /// public string Head { get; private set; } - /// - /// Whether maintainers of the base repository can push to if it is a branch - /// - public bool MaintainerCanModify { get; private set; } + /// + /// Whether maintainers of the base repository can push to if it is a branch + /// + public bool MaintainerCanModify { get; private set; } /// /// Body of the pull request (optional) diff --git a/Octokit/Models/Request/PullRequestUpdate.cs b/Octokit/Models/Request/PullRequestUpdate.cs index 7beeac0d49..2220d05c71 100644 --- a/Octokit/Models/Request/PullRequestUpdate.cs +++ b/Octokit/Models/Request/PullRequestUpdate.cs @@ -29,12 +29,12 @@ public class PullRequestUpdate /// public string Base { get; set; } - /// - /// Whether maintainers of the base repository can push to if it is a branch - /// - public bool MaintainerCanModify { get; set; } + /// + /// Whether maintainers of the base repository can push to if it is a branch + /// + public bool MaintainerCanModify { get; set; } - internal string DebuggerDisplay + internal string DebuggerDisplay { get { From 04c829e834cca45a916922f831709a6ad19420ad Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 27 Feb 2018 09:33:56 -0500 Subject: [PATCH 08/11] Fix PullRequestUpdate and NewPullRequest doc comments --- Octokit/Models/Request/NewPullRequest.cs | 4 ++-- Octokit/Models/Request/PullRequestUpdate.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Octokit/Models/Request/NewPullRequest.cs b/Octokit/Models/Request/NewPullRequest.cs index 0622d51ad3..7a03ae8ff7 100644 --- a/Octokit/Models/Request/NewPullRequest.cs +++ b/Octokit/Models/Request/NewPullRequest.cs @@ -15,7 +15,7 @@ public class NewPullRequest /// The title of the pull request. /// The branch (or git ref where your changes are implemented. In other words, the source branch/ref /// The base (or git ref) reference you want your changes pulled into. In other words, the target branch/ref - /// Whether maintainers of the base repository can push to if it is a branch + /// Whether maintainers of the base repository can push to if it is a branch public NewPullRequest(string title, string head, string baseRef, bool maintainerCanModify) { Ensure.ArgumentNotNullOrEmptyString(title, "title"); @@ -44,7 +44,7 @@ public NewPullRequest(string title, string head, string baseRef, bool maintainer public string Head { get; private set; } /// - /// Whether maintainers of the base repository can push to if it is a branch + /// Whether maintainers of the base repository can push to if it is a branch /// public bool MaintainerCanModify { get; private set; } diff --git a/Octokit/Models/Request/PullRequestUpdate.cs b/Octokit/Models/Request/PullRequestUpdate.cs index 2220d05c71..f1bbdccd23 100644 --- a/Octokit/Models/Request/PullRequestUpdate.cs +++ b/Octokit/Models/Request/PullRequestUpdate.cs @@ -30,7 +30,7 @@ public class PullRequestUpdate public string Base { get; set; } /// - /// Whether maintainers of the base repository can push to if it is a branch + /// Whether maintainers of the base repository can push to the pull request's HEAD if it is a branch /// public bool MaintainerCanModify { get; set; } From 6c2c31e9d2c9969c9a726fae377bc5d60a84b011 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 5 Mar 2018 10:37:19 -0500 Subject: [PATCH 09/11] Revert "Update NewPulRequest tests" This reverts commit f20dfa7d0efc5ed18b7d622a0eb9b5d1f578f9a5. --- ...equestReviewCommentReactionsClientTests.cs | 2 +- .../PullRequestReviewCommentsClientTests.cs | 2 +- .../PullRequestReviewRequestsClientTests.cs | 2 +- .../Clients/PullRequestsClientTests.cs | 110 +++++++++--------- .../Helpers/RepositorySetupHelper.cs | 2 +- .../Clients/PullRequestsClientTests.cs | 20 ++-- .../ObservablePullRequestsClientTests.cs | 12 +- 7 files changed, 74 insertions(+), 76 deletions(-) diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs index 65b84a1609..4044adde88 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs @@ -146,7 +146,7 @@ async Task CreatePullRequest(RepositoryContext context) // Creating a pull request - var pullRequest = new NewPullRequest("Nice title for the pull request", branchName, "master", false); + var pullRequest = new NewPullRequest("Nice title for the pull request", branchName, "master"); var createdPullRequest = await _github.PullRequest.Create(Helper.UserName, repoName, pullRequest); var data = new PullRequestData diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs index a62f45106d..ad51225dbe 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs @@ -870,7 +870,7 @@ async Task CreatePullRequest(RepositoryContext context, string // Creating a pull request - var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master", false); + var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master"); var createdPullRequest = await _github.PullRequest.Create(Helper.UserName, repoName, pullRequest); var data = new PullRequestData diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewRequestsClientTests.cs index c14915dd96..b139b3b145 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewRequestsClientTests.cs @@ -244,7 +244,7 @@ static async Task CreateTheWorld(IGitHubClient github, RepositoryContext co await github.Git.Reference.Create(context.RepositoryOwner, context.RepositoryName, new NewReference("refs/heads/my-branch", featureBranchCommit2.Sha)); // create a pull request - var pullRequest = new NewPullRequest("Nice title for the pull request", "my-branch", "master", false); + var pullRequest = new NewPullRequest("Nice title for the pull request", "my-branch", "master"); var createdPullRequest = await github.PullRequest.Create(context.RepositoryOwner, context.RepositoryName, pullRequest); // Create review requests (optional) diff --git a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs index 9be4e8cc03..9afd3ae656 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs @@ -32,7 +32,7 @@ public async Task CanCreate() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); Assert.Equal("a pull request", result.Title); } @@ -42,7 +42,7 @@ public async Task CanCreateWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(_context.Repository.Id, newPullRequest); Assert.Equal("a pull request", result.Title); } @@ -52,7 +52,7 @@ public async Task CanGetForRepository() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName); @@ -67,7 +67,7 @@ public async Task CanGetForRepositoryWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id); @@ -81,7 +81,7 @@ public async Task CanGetWithAssigneesForRepository() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); // Add an assignee @@ -104,7 +104,7 @@ public async Task CanGetWithAssigneesForRepositoryWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(_context.Repository.Id, newPullRequest); // Add an assignee @@ -127,7 +127,7 @@ public async Task ReturnsCorrectCountOfPullRequestsWithoutStart() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var options = new ApiOptions @@ -147,7 +147,7 @@ public async Task ReturnsCorrectCountOfPullRequestsWithoutStartWithRepositoryId( { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var options = new ApiOptions @@ -167,8 +167,8 @@ public async Task ReturnsCorrectCountOfPullRequestsWithStart() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -190,8 +190,8 @@ public async Task ReturnsCorrectCountOfPullRequestsWithStartWithRepositoryId() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -213,8 +213,8 @@ public async Task ReturnsDistinctPullRequestsBasedOnStartPage() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -243,8 +243,8 @@ public async Task ReturnsDistinctPullRequestsBasedOnStartPageWithRepositoryId() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -273,7 +273,7 @@ public async Task CanGetOpenPullRequest() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", true); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; @@ -281,7 +281,6 @@ public async Task CanGetOpenPullRequest() Assert.Equal(1, pullRequests.Count); Assert.Equal(result.Title, pullRequests[0].Title); - Assert.Equal(true, pullRequests[0].MaintainerCanModify); } [IntegrationTest] @@ -289,7 +288,7 @@ public async Task CanGetOpenPullRequestWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; @@ -297,7 +296,6 @@ public async Task CanGetOpenPullRequestWithRepositoryId() Assert.Equal(1, pullRequests.Count); Assert.Equal(result.Title, pullRequests[0].Title); - Assert.Equal(false, pullRequests[0].MaintainerCanModify); } [IntegrationTest] @@ -305,7 +303,7 @@ public async Task ReturnsCorrectCountOfPullRequestsWithoutStartParameterized() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var options = new ApiOptions @@ -326,7 +324,7 @@ public async Task ReturnsCorrectCountOfPullRequestsWithoutStartParameterizedWith { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var options = new ApiOptions @@ -347,8 +345,8 @@ public async Task ReturnsCorrectCountOfPullRequestsWithStartParameterized() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -371,8 +369,8 @@ public async Task ReturnsCorrectCountOfPullRequestsWithStartParameterizedWithRep { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -395,8 +393,8 @@ public async Task ReturnsDistinctPullRequestsBasedOnStartPageParameterized() { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -427,8 +425,8 @@ public async Task ReturnsDistinctPullRequestsBasedOnStartPageParameterizedWithRe { await CreateTheWorld(); - var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master", false); - var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master", false); + var newPullRequest1 = new NewPullRequest("a pull request 1", branchName, "master"); + var newPullRequest2 = new NewPullRequest("a pull request 2", otherBranchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest1); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); @@ -459,7 +457,7 @@ public async Task IgnoresOpenPullRequest() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Closed }; @@ -473,7 +471,7 @@ public async Task IgnoresOpenPullRequestWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Closed }; @@ -487,7 +485,7 @@ public async Task CanUpdate() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var updatePullRequest = new PullRequestUpdate { Title = "updated title", Body = "Hello New Body", Base = "my-other-branch" }; @@ -503,7 +501,7 @@ public async Task CanUpdateWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var updatePullRequest = new PullRequestUpdate { Title = "updated title", Body = "Hello New Body", Base = "my-other-branch" }; @@ -519,7 +517,7 @@ public async Task CanClose() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var updatePullRequest = new PullRequestUpdate { State = ItemState.Closed }; @@ -535,7 +533,7 @@ public async Task CanFindClosedPullRequest() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var updatePullRequest = new PullRequestUpdate { State = ItemState.Closed }; @@ -552,10 +550,10 @@ public async Task CanSortPullRequests() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); - var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master", false); + var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master"); var anotherPullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); var updatePullRequest = new PullRequestUpdate { Body = "This is the body" }; @@ -575,10 +573,10 @@ public async Task CanSpecifyDirectionOfSort() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); - var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master", false); + var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master"); var anotherPullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest2); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, new PullRequestRequest { SortDirection = SortDirection.Ascending }); @@ -593,7 +591,7 @@ public async Task IsNotMergedInitially() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var result = await _fixture.Merged(Helper.UserName, _context.RepositoryName, pullRequest.Number); @@ -606,7 +604,7 @@ public async Task IsNotMergedInitiallyWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var result = await _fixture.Merged(_context.Repository.Id, pullRequest.Number); @@ -619,7 +617,7 @@ public async Task CanBeMerged() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "thing the thing" }; @@ -633,7 +631,7 @@ public async Task CanBeMergedWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "thing the thing" }; @@ -647,7 +645,7 @@ public async Task CanBeMergedWithNoOptionalInput() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest(); @@ -661,7 +659,7 @@ public async Task CanBeMergedWithShaSpecified() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "thing the thing", Sha = pullRequest.Head.Sha }; @@ -675,7 +673,7 @@ public async Task CanBeMergedWithMergeMethod() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "fake commit message", CommitTitle = "fake title", MergeMethod = PullRequestMergeMethod.Merge }; @@ -691,7 +689,7 @@ public async Task CanBeMergedWithSquashMethod() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "fake commit message", CommitTitle = "fake title", MergeMethod = PullRequestMergeMethod.Squash }; @@ -707,7 +705,7 @@ public async Task CanBeMergedWithRebaseMethod() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("squash commit pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "fake commit message", CommitTitle = "fake title", MergeMethod = PullRequestMergeMethod.Rebase }; @@ -724,7 +722,7 @@ public async Task CannotBeMergedDueMismatchConflict() await CreateTheWorld(); var fakeSha = new string('f', 40); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { Sha = fakeSha }; @@ -743,7 +741,7 @@ public async Task CannotBeMergedDueNotInMergeableState() var masterCommit = await CreateCommit("Commit in master", newMasterTree.Sha, master.Object.Sha); await _github.Git.Reference.Update(Helper.UserName, _context.RepositoryName, "heads/master", new ReferenceUpdate(masterCommit.Sha)); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); await Task.Delay(TimeSpan.FromSeconds(5)); @@ -764,7 +762,7 @@ public async Task UpdatesMaster() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var merge = new MergePullRequest { CommitMessage = "thing the thing" }; @@ -780,7 +778,7 @@ public async Task CanBrowseCommits() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var result = await _fixture.Commits(Helper.UserName, _context.RepositoryName, pullRequest.Number); @@ -794,7 +792,7 @@ public async Task CanBrowseCommitsWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); var result = await _fixture.Commits(_context.Repository.Id, pullRequest.Number); @@ -808,7 +806,7 @@ public async Task CanGetCommitsAndCommentCount() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); // create new commit for branch @@ -840,7 +838,7 @@ public async Task CanGetCommitsAndCommentCountWithRepositoryId() { await CreateTheWorld(); - var newPullRequest = new NewPullRequest("a pull request", branchName, "master", false); + var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var pullRequest = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); // create new commit for branch diff --git a/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs b/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs index b4e8190028..3bfa7f4d02 100644 --- a/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs +++ b/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs @@ -63,7 +63,7 @@ public static async Task CreateTheWorld(this IGitHubClient client, Re public static async Task CreatePullRequest(this IGitHubClient client, Repository repository, string branch = "my-branch") { - var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master", false); + var pullRequest = new NewPullRequest("Nice title for the pull request", branch, "master"); var createdPullRequest = await client.PullRequest.Create(repository.Owner.Login, repository.Name, pullRequest); return createdPullRequest; diff --git a/Octokit.Tests/Clients/PullRequestsClientTests.cs b/Octokit.Tests/Clients/PullRequestsClientTests.cs index 16a07f9241..f30d2e89ca 100644 --- a/Octokit.Tests/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests/Clients/PullRequestsClientTests.cs @@ -236,7 +236,7 @@ public class TheCreateMethod [Fact] public async Task PostsToCorrectUrl() { - var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false); + var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name"); var connection = Substitute.For(); var client = new PullRequestsClient(connection); @@ -249,7 +249,7 @@ public async Task PostsToCorrectUrl() [Fact] public async Task PostsToCorrectUrlWithRepositoryId() { - var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false); + var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name"); var connection = Substitute.For(); var client = new PullRequestsClient(connection); @@ -265,14 +265,14 @@ public async Task EnsuresNonNullArguments() var connection = Substitute.For(); var client = new PullRequestsClient(connection); - await Assert.ThrowsAsync(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2", false))); - await Assert.ThrowsAsync(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2", false))); + await Assert.ThrowsAsync(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2"))); + await Assert.ThrowsAsync(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2"))); await Assert.ThrowsAsync(() => client.Create("owner", "name", null)); await Assert.ThrowsAsync(() => client.Create(1, null)); - await Assert.ThrowsAsync(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2", false))); - await Assert.ThrowsAsync(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2", false))); + await Assert.ThrowsAsync(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2"))); + await Assert.ThrowsAsync(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2"))); } } @@ -310,14 +310,14 @@ public async Task EnsuresNonNullArguments() var connection = Substitute.For(); var client = new PullRequestsClient(connection); - await Assert.ThrowsAsync(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2", false))); - await Assert.ThrowsAsync(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2", false))); + await Assert.ThrowsAsync(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2"))); + await Assert.ThrowsAsync(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2"))); await Assert.ThrowsAsync(() => client.Create("owner", "name", null)); await Assert.ThrowsAsync(() => client.Create(1, null)); - await Assert.ThrowsAsync(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2", false))); - await Assert.ThrowsAsync(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2", false))); + await Assert.ThrowsAsync(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2"))); + await Assert.ThrowsAsync(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2"))); } } diff --git a/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs index 2e22b0e01b..8ca0e56061 100644 --- a/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs @@ -462,7 +462,7 @@ public class TheCreateMethod [Fact] public void CreatesFromClientRepositoryPullRequest() { - var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false); + var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name"); var gitHubClient = Substitute.For(); var client = new ObservablePullRequestsClient(gitHubClient); @@ -474,7 +474,7 @@ public void CreatesFromClientRepositoryPullRequest() [Fact] public void CreatesFromClientRepositoryPullRequestWithRepositoryId() { - var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name", false); + var newPullRequest = new NewPullRequest("some title", "branch:name", "branch:name"); var gitHubClient = Substitute.For(); var client = new ObservablePullRequestsClient(gitHubClient); @@ -489,14 +489,14 @@ public void EnsuresNonNullArguments() var gitHubClient = Substitute.For(); var client = new ObservablePullRequestsClient(gitHubClient); - Assert.Throws(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2", false))); - Assert.Throws(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2", false))); + Assert.Throws(() => client.Create(null, "name", new NewPullRequest("title", "ref", "ref2"))); + Assert.Throws(() => client.Create("owner", null, new NewPullRequest("title", "ref", "ref2"))); Assert.Throws(() => client.Create("owner", "name", null)); Assert.Throws(() => client.Create(1, null)); - Assert.Throws(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2", false))); - Assert.Throws(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2", false))); + Assert.Throws(() => client.Create("", "name", new NewPullRequest("title", "ref", "ref2"))); + Assert.Throws(() => client.Create("owner", "", new NewPullRequest("title", "ref", "ref2"))); } } From 56819dfcaef6a83368e654510b3b6995cc6d2537 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Mon, 5 Mar 2018 10:39:39 -0500 Subject: [PATCH 10/11] Make MaintainerCanModify fields nullable --- Octokit/Models/Request/NewPullRequest.cs | 6 ++---- Octokit/Models/Request/PullRequestUpdate.cs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Octokit/Models/Request/NewPullRequest.cs b/Octokit/Models/Request/NewPullRequest.cs index 7a03ae8ff7..a3aaf6d459 100644 --- a/Octokit/Models/Request/NewPullRequest.cs +++ b/Octokit/Models/Request/NewPullRequest.cs @@ -15,8 +15,7 @@ public class NewPullRequest /// The title of the pull request. /// The branch (or git ref where your changes are implemented. In other words, the source branch/ref /// The base (or git ref) reference you want your changes pulled into. In other words, the target branch/ref - /// Whether maintainers of the base repository can push to if it is a branch - public NewPullRequest(string title, string head, string baseRef, bool maintainerCanModify) + public NewPullRequest(string title, string head, string baseRef) { Ensure.ArgumentNotNullOrEmptyString(title, "title"); Ensure.ArgumentNotNullOrEmptyString(head, "head"); @@ -25,7 +24,6 @@ public NewPullRequest(string title, string head, string baseRef, bool maintainer Title = title; Head = head; Base = baseRef; - MaintainerCanModify = maintainerCanModify; } /// @@ -46,7 +44,7 @@ public NewPullRequest(string title, string head, string baseRef, bool maintainer /// /// Whether maintainers of the base repository can push to if it is a branch /// - public bool MaintainerCanModify { get; private set; } + public bool? MaintainerCanModify { get; private set; } /// /// Body of the pull request (optional) diff --git a/Octokit/Models/Request/PullRequestUpdate.cs b/Octokit/Models/Request/PullRequestUpdate.cs index f1bbdccd23..0193de1548 100644 --- a/Octokit/Models/Request/PullRequestUpdate.cs +++ b/Octokit/Models/Request/PullRequestUpdate.cs @@ -32,7 +32,7 @@ public class PullRequestUpdate /// /// Whether maintainers of the base repository can push to the pull request's HEAD if it is a branch /// - public bool MaintainerCanModify { get; set; } + public bool? MaintainerCanModify { get; set; } internal string DebuggerDisplay { From f72b21804ac9c286c487fbfce2510d5071e51807 Mon Sep 17 00:00:00 2001 From: Ryan Gribble Date: Mon, 16 Apr 2018 22:25:31 +1000 Subject: [PATCH 11/11] tweak doco comment and make setter public so it can be used --- Octokit/Models/Request/NewPullRequest.cs | 4 ++-- Octokit/Models/Request/PullRequestUpdate.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Octokit/Models/Request/NewPullRequest.cs b/Octokit/Models/Request/NewPullRequest.cs index a3aaf6d459..f384f009fd 100644 --- a/Octokit/Models/Request/NewPullRequest.cs +++ b/Octokit/Models/Request/NewPullRequest.cs @@ -42,9 +42,9 @@ public NewPullRequest(string title, string head, string baseRef) public string Head { get; private set; } /// - /// Whether maintainers of the base repository can push to if it is a branch + /// Whether maintainers of the base repository can push to the HEAD branch (optional). /// - public bool? MaintainerCanModify { get; private set; } + public bool? MaintainerCanModify { get; set; } /// /// Body of the pull request (optional) diff --git a/Octokit/Models/Request/PullRequestUpdate.cs b/Octokit/Models/Request/PullRequestUpdate.cs index 0193de1548..853ccafa7e 100644 --- a/Octokit/Models/Request/PullRequestUpdate.cs +++ b/Octokit/Models/Request/PullRequestUpdate.cs @@ -30,7 +30,7 @@ public class PullRequestUpdate public string Base { get; set; } /// - /// Whether maintainers of the base repository can push to the pull request's HEAD if it is a branch + /// Whether maintainers of the base repository can push to the HEAD branch. /// public bool? MaintainerCanModify { get; set; }