Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull Requests API Implementation #173

Closed

Conversation

jpsullivan
Copy link
Contributor

Attempting to take a stab at #135.

Basic functionality for Pull Requests is in place. As of now, the only things missing from this are:

  • Fetching commits within a pull request
  • Merging pull requests
  • Determining "mergibility" of a particular pull request
  • Integration tests for the PullRequestsClient class

Otherwise, to me this seems like a good starting point. Don't hold back if I screwed up something! 👍

Still missing pull request files, commit lists and merge checks.
Still missing integration tests for Pull Requests, though.  I need to do
a bit more research before I can start to tackle that one.
/// <param name="name">The name of the repository</param>
/// <param name="request">Used to filter and sort the list of pull requests returned</param>
/// <returns></returns>
IObservable<PullRequest> GetForRepository(string owner, string name, PullRequestRequest request);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PullRequestRequest hah! I guess that's a consequence of our current naming scheme. It's fiiiiine. I just had to comment as I LOL'd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahaha, yeah I was wondering how you guys would react to that. I got a good laugh out of that as well :)

@haacked
Copy link
Contributor

haacked commented Nov 5, 2013

Thank you so much for this. This is great work. I had a few nitpicky comments.

I appreciate that you remembered to add the project files to the NetCor45 project. Most people (myself included) forget. Could you also add them to:

Unfortunately, I could not add these to the Solution so they're easy to miss.

@jpsullivan
Copy link
Contributor Author

No problem! Happy to help :)

Already working on patching up those little things. As for the MonoTouch and MonoAndroid projects, I see them included within the solution, but as you can see they aren't "included" yet. I can certainly add the references manually, but I figured I'd check to make sure that something hasn't gotten screwed up with my development environment.

octokit

Thanks again for the great lib, you guys! Can't wait to contribute more 🤘

@haacked
Copy link
Contributor

haacked commented Nov 5, 2013

I think those project types only work in Xamarin Studio. Is that right @paulcbetts. So for now, manually editing them is our only recourse. Or installing Xamarin Studio and opening them in there.

Manually referenced as this requires Xamarin studio to do automatically.
@jpsullivan
Copy link
Contributor Author

Ah, gotcha gotcha. That makes much more sense.

@haacked
Copy link
Contributor

haacked commented Nov 8, 2013

How's this coming along? Need any help? Looks like it's out of date with upstream master. Do you know how to update it?

@jpsullivan
Copy link
Contributor Author

Sure do, just haven't gotten the time to dedicate to it these last couple days unfortunately. Planning on getting everything taken care of this weekend, though!

@haacked
Copy link
Contributor

haacked commented Nov 8, 2013

Great! Carry on! 🍰

@anaisbetts
Copy link
Contributor

I think those project types only work in Xamarin Studio. Is that right @paulcbetts. So for now, manually editing them is our only recourse. Or installing Xamarin Studio and opening them in there.

They work in Visual Studio, but only if you have a Xamarin license which costs a fair amount of 💰. Don't worry about verifying the build or anything, just add in the files. If it works in Octokit.csproj it almost certainly works in the Mono version too.

Removed default parameter from pull request merge message according to
CA1026.
Bugfix for building the merge api url, as well.
Renamed and enhanced existing Merged tests.
- Initial integration test for pull requests (can't seem to do much
without the tree api)
- Added Observable unit tests for the rest of the pull request client
@jpsullivan
Copy link
Contributor Author

So I'm pretty sure that this is all taken care of, but it should be noted that integration tests can't really be done until the Trees API is implemented (unless I'm missing something here). I'm a little hesitant to call this "done" until those are implemented, but as far as I can tell, I've added in everything I can.

As always, feel free to let me know if I screwed up anything!

Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");

return ApiConnection.Get<PullRequestMerge>(ApiUrls.MergePullRequest(owner, name, number));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged doesn't return a response - you need to check the status code to see whether a pull request has been merged:

204 No Content indicates it has been merged
404 Not Found indicates it has not been merged

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this code for a similar example

NewPullRequest constructor only takes required params.  Each required
parameter is now a readonly property.
@jpsullivan
Copy link
Contributor Author

Done and done. Loving that little utility to handle adding in all of the referenced .cs files! Very handy. 👍

@shiftkey
Copy link
Member

@jpsullivan don't thank us, thank @forki! 😀

@jpsullivan
Copy link
Contributor Author

@forki you're doing the Lords work, my son. 🍻

@@ -204,4 +204,4 @@ public Task<string> GetReadmeHtml(string owner, string name)
/// </remarks>
public IRepoCollaboratorsClient RepoCollaborators { get; private set; }
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what happened here, (merging master perhaps clobbering your changes?) but I've got a compiler error here:

Octokit\Clients\RepositoriesClient.cs(15,18,15,36): error CS0535: 'Octokit.RepositoriesClient' does not implement interface member 'Octokit.IRepositoriesClient.PullRequest'

@shiftkey
Copy link
Member

@jpsullivan I've dropped a few comments in based on my testing and review. It's coming together!

@jpsullivan
Copy link
Contributor Author

Thanks a lot man! Sorry that it seems kinda like amateur hour up in here... I'll get these patched up pronto.

@shiftkey
Copy link
Member

@jpsullivan don't sweat it, take your time.

@shiftkey
Copy link
Member

shiftkey commented Dec 8, 2013

@jpsullivan anything left on this?

I'll review it the next time I have internet access but let me know if there's anything particular I should look at.

@jpsullivan
Copy link
Contributor Author

@shiftkey Yep, still working on a few more details, particularly getting the integration tests sorted out now that I see Trees have been implemented. Will let you know when this is all ready for a review, though.

@shiftkey
Copy link
Member

shiftkey commented Dec 8, 2013

@jpsullivan

IObservable<PullRequest> Create(string owner, string name, NewPullRequest newPullRequest);

/// <summary>
/// Creates a pull request for the specified repository.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be `Updates a pull request..``?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nulltoken yes, yes it should

@shiftkey shiftkey mentioned this pull request Feb 3, 2014
8 tasks
@shiftkey shiftkey closed this Feb 3, 2014
@jpsullivan jpsullivan deleted the jpsullivan/pull-requests-api branch June 26, 2023 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants