去掉全局变量,通过filter获取
This commit is contained in:
parent
3198f8a473
commit
097374df14
|
@ -38,7 +38,7 @@ class RepositoriesController < ApplicationController
|
|||
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
|
||||
before_filter :authorize , :except => [:newrepo,:newcreate,:fork, :to_gitlab, :forked, :commit_diff, :project_archive, :quality_analysis]
|
||||
# 链接gitlab
|
||||
before_filter :connect_gitlab, :only => [:quality_analysis, :show]
|
||||
before_filter :connect_gitlab, :only => [:quality_analysis, :show, :commit_diff, :find_project_repository]
|
||||
# 版本库新增权限
|
||||
before_filter :show_rep, :only => [:show]
|
||||
accept_rss_auth :revisions
|
||||
|
@ -48,8 +48,7 @@ class RepositoriesController < ApplicationController
|
|||
include RepositoriesHelper
|
||||
helper :project_score
|
||||
#@root_path = RepositoriesHelper::ROOT_PATH
|
||||
$g=Gitlab.client
|
||||
# require 'net/ssh'
|
||||
require 'net/ssh'
|
||||
|
||||
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
|
||||
def new
|
||||
|
@ -548,8 +547,8 @@ update
|
|||
|
||||
# 每次提交对应的文件差异
|
||||
def commit_diff
|
||||
@commit_diff = $g.commit_diff(@project.gpid, params[:changeset])
|
||||
@commit_details = $g.commit(@project.gpid, params[:changeset])
|
||||
@commit_diff = @g.commit_diff(@project.gpid, params[:changeset])
|
||||
@commit_details = @g.commit(@project.gpid, params[:changeset])
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
|
||||
|
@ -700,7 +699,8 @@ update
|
|||
(render_404; return false) unless @repository
|
||||
@path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s
|
||||
# gitlab端获取默认分支
|
||||
gitlab_branchs = $g.project(@project.gpid).default_branch
|
||||
g = Gitlab.client
|
||||
gitlab_branchs = g.project(@project.gpid).default_branch
|
||||
@project.gpid.nil? ? (@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip) : (@rev = params[:rev].blank? ? gitlab_branchs : params[:rev].to_s.strip)
|
||||
@rev_to = params[:rev_to]
|
||||
unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE)
|
||||
|
|
Loading…
Reference in New Issue