Expose more information about open merge requests #2901

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants
Contributor

calmh commented Feb 4, 2013

This adds a new API call per project that returns all open merge requests, including notes and commits. We use this to automatically evaluate merge requests for style etc and post a +1 or -1.

Since the existing merge requests call returns all MR:s (even those already closed or merged) and the new information I want to return might be expensive, I chose to add a new API call for only open requests instead of fleshing out the existing one.

calmh added some commits Feb 4, 2013

@calmh calmh Expose detailed information on open MR:s in API
This exposes detailed open merge requests for a certain project, while
keeping the existing API intact.
ef922c3
@calmh calmh Update documentation for new API call c97c0a9

@AlexDenisov AlexDenisov commented on the diff Feb 4, 2013

lib/api/merge_requests.rb
@@ -19,6 +19,23 @@ class MergeRequests < Grape::API
present paginate(user_project.merge_requests), with: Entities::MergeRequest
end
+ # List open merge requests
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ #
+ # Example:
+ # GET /projects/:id/open_merge_requests
+ #
+ # Returns a more detailed merge request object than the method above,
+ # including unmerged commits.
+ #
+ get ":id/open_merge_requests" do
+ authorize! :read_merge_request, user_project
+
+ present paginate(user_project.merge_requests.where(:closed => false, :merged => false)), with: Entities::DetailedMergeRequest
@AlexDenisov

AlexDenisov Feb 4, 2013

Contributor

I think that better solution is to move this to user_project entity, and add new scope.
Also, you should use new ruby syntax closed: false instead of :closed => false.

Contributor

AlexDenisov commented Feb 4, 2013

Could you add tests, that cover this cases?

Contributor

calmh commented Feb 4, 2013

Sure. I need to familiarize myself with the infrastructure, ignore this one until then.

Contributor

mikkyhouse commented Feb 25, 2013

Closing this one since it need some tests. Feel free to open new one when tests will be ready

mikkyhouse closed this Feb 25, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment