|
|
|
@ -2,6 +2,7 @@ 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]
|
|
|
|
|
layout "base_projects"
|
|
|
|
|
include PullRequestsHelper
|
|
|
|
|
|
|
|
|
|
# 返回json格式
|
|
|
|
|
def index
|
|
|
|
@ -22,6 +23,16 @@ class PullRequestsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def new
|
|
|
|
|
@rev = @g.branches(@project.gpid).map{|b| b.name}
|
|
|
|
|
@target_project = []
|
|
|
|
|
if @project.forked_from_project_id
|
|
|
|
|
@forked_project = Project.find(@project.forked_from_project_id)
|
|
|
|
|
unless @forked_project.blank?
|
|
|
|
|
@target_project << "#{get_user_name(@forked_project.user_id)}/#{@forked_project.name}"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
# @forked_rev = @g.branches(forked_project.gpid).map{|b| b.name}
|
|
|
|
|
@target_project << "#{get_user_name(@project.user_id)}/#{@project.name}"
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# Creates a merge request.
|
|
|
|
@ -45,6 +56,7 @@ class PullRequestsController < ApplicationController
|
|
|
|
|
description = params[:description]
|
|
|
|
|
source_branch = params[:source_branch]
|
|
|
|
|
target_branch = params[:target_branch]
|
|
|
|
|
target_project = 1549
|
|
|
|
|
begin
|
|
|
|
|
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch)
|
|
|
|
|
respond_to do |format|
|
|
|
|
|