@ -110,7 +110,20 @@ class PullRequestsController < ApplicationController
end
end
end
end
# 更新请求的状态state => cloesed
# Updates a merge request.
#
# @example
# Gitlab.update_merge_request(5, 42, :title => 'New title')
#
# @param [Integer] project The ID of a project.
# @param [Integer] id The ID of a merge request.
# @param [Hash] options A customizable set of options.
# @option options [String] :title The title of a merge request.
# @option options [String] :source_branch The source branch name.
# @option options [String] :target_branch The target branch name.
# @option options [Integer] :assignee_id The ID of a user to assign merge request.
# @option options [String] :state_event New state (close|reopen|merge).
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
def update_pull_request
def update_pull_request
begin
begin
@g . update_merge_request ( @project . gpid , params [ :id ] , :state_event = > params [ :state ] )
@g . update_merge_request ( @project . gpid , params [ :id ] , :state_event = > params [ :state ] )
@ -122,16 +135,57 @@ class PullRequestsController < ApplicationController
end
end
end
end
# 获取某次请求的提交次数
# Creates a merge request.
#
# @example
# Gitlab.create_merge_request(5, 'New merge request',
# :source_branch => 'source_branch', :target_branch => 'target_branch')
# Gitlab.create_merge_request(5, 'New merge request',
# :source_branch => 'source_branch', :target_branch => 'target_branch', :assignee_id => 42)
def create_pull_request_comment
content = params [ :content ]
begin
@comments = @g . create_merge_request_comment ( @project . gpid , params [ :id ] , content )
rescue Exception = > e
@message = e . message
end
end
# Gets the comments on a merge request.
#
# @example
# Gitlab.merge_request_comments(5, 1)
def pull_request_comments
begin
@comments = @g . merge_request_comments ( @project . gpid , params [ :id ] )
rescue Exception = > e
@message = e . message
end
end
# Get a list of merge request commits.
# Parameters:
# id (required) - The ID of a project
# merge_request_id (required) - The ID of MR
def pull_request_commits
def pull_request_commits
@type = parms [ :type ]
begin
@commits = @g . merge_request_commits ( @project . gpid , params [ :id ] . to_i )
@commits = @g . merge_request_commits ( @project . gpid , params [ :id ] )
rescue Exception = > e
@message = e . message
end
end
end
# 获取某次请求的改动
# Shows information about the merge request including its files and changes. With GitLab 8.2 the return fields upvotes and downvotes are deprecated and always return 0.
# Parameters:
# id (required) - The ID of a project
# merge_request_id (required) - The ID of MR
def pull_request_changes
def pull_request_changes
begin
@changes = @g . merge_request_changes ( @project . gpid , params [ :id ] ) . try ( :changes )
@changes = @g . merge_request_changes ( @project . gpid , params [ :id ] ) . try ( :changes )
@changes_count = @changes . count
@changes_count = @changes . count
rescue Exception = > e
@message = e . message
end
end
end
private
private