PR添加评论定义
This commit is contained in:
parent
d1b4e83fee
commit
6319a1bac6
|
@ -110,7 +110,20 @@ class PullRequestsController < ApplicationController
|
|||
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
|
||||
begin
|
||||
@g.update_merge_request(@project.gpid, params[:id], :state_event => params[:state])
|
||||
|
@ -122,16 +135,57 @@ class PullRequestsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 获取某次请求的提交次数
|
||||
def pull_request_commits
|
||||
@type = parms[:type]
|
||||
@commits = @g.merge_request_commits(@project.gpid, params[:id].to_i)
|
||||
# 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
|
||||
begin
|
||||
@commits = @g.merge_request_commits(@project.gpid, params[:id])
|
||||
rescue Exception => e
|
||||
@message = e.message
|
||||
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
|
||||
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
||||
@changes_count = @changes.count
|
||||
begin
|
||||
@changes = @g.merge_request_changes(@project.gpid, params[:id]).try(:changes)
|
||||
@changes_count = @changes.count
|
||||
rescue Exception => e
|
||||
@message = e.message
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -817,6 +817,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'pull_request_commits'
|
||||
get 'pull_request_changes'
|
||||
get 'update_pull_request'
|
||||
get 'pull_request_comments'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue