diff options
author | 🙈 jacopo beschi 🙉 <intrip@gmail.com> | 2018-09-05 16:07:02 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-09-05 16:07:02 +0300 |
commit | 20bd1e6b34417a2b9f688071e2891a64d1653770 (patch) | |
tree | 88c9bb554659f57e4ffb23d657aa69d6ceea534e /lib/api | |
parent | cff47b2045999ba5ab1af7cf8c0aa45b2c52fb36 (diff) |
Resolve "Return how many commits the source branch is behind the target branch through the API"
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/api/merge_requests.rb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 624eda3f5dd..e63f11d721e 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -687,6 +687,8 @@ module API expose :diff_refs, using: Entities::DiffRefs + expose :diverged_commits_count, as: :diverged_commits_count, if: -> (_, options) { options[:include_diverged_commits_count] } + def build_available?(options) options[:project]&.feature_available?(:builds, options[:current_user]) end diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index abad418771c..55f54fe3c43 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -233,6 +233,7 @@ module API params do requires :merge_request_iid, type: Integer, desc: 'The IID of a merge request' optional :render_html, type: Boolean, desc: 'Returns the description and title rendered HTML' + optional :include_diverged_commits_count, type: Boolean, desc: 'Returns the commits count behind the target branch' end desc 'Get a single merge request' do success Entities::MergeRequest @@ -240,7 +241,7 @@ module API get ':id/merge_requests/:merge_request_iid' do merge_request = find_merge_request_with_access(params[:merge_request_iid]) - present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project, render_html: params[:render_html] + present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project, render_html: params[:render_html], include_diverged_commits_count: params[:include_diverged_commits_count] end desc 'Get the participants of a merge request' do |