|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
|
|
class PullRequestsController < ApplicationController
|
|
|
|
|
before_filter :find_project_and_repository
|
|
|
|
|
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new]
|
|
|
|
@ -61,13 +62,15 @@ class PullRequestsController < ApplicationController
|
|
|
|
|
begin
|
|
|
|
|
# 如果传送了目标项目ID,则PR请求发至目标项目
|
|
|
|
|
if params[:forked_project_id] && params[:source_project] == "forked_project_name"
|
|
|
|
|
target_project_id = params[:target_project_id]
|
|
|
|
|
target_project_id = params[:forked_project_id].to_i
|
|
|
|
|
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id)
|
|
|
|
|
@fork_project_name = Project.find(@project.forked_from_project_id).try(:name)
|
|
|
|
|
@fork_pr_message = true if @fork_project_name
|
|
|
|
|
else
|
|
|
|
|
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch)
|
|
|
|
|
end
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
@message = e.message
|
|
|
|
|