版本库代码简化
This commit is contained in:
parent
25b2602d3e
commit
0906da5132
|
@ -376,22 +376,6 @@ update
|
|||
|
||||
def show
|
||||
## TODO: the below will move to filter, done.
|
||||
|
||||
# 获取版本库目录结构
|
||||
@entries = @repository.entries(@path, @rev)
|
||||
if request.xhr?
|
||||
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
|
||||
else
|
||||
@changesets = @g.commits(@project.gpid, :ref_name => @rev)
|
||||
# 最近一次提交
|
||||
@changesets_latest_coimmit = @changesets[0]
|
||||
g_project = @g.project(@project.gpid)
|
||||
# 总的提交数
|
||||
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
|
||||
|
||||
# 获取默认分支
|
||||
@g_default_branch = g_project.default_branch.nil? ? "master" : g_project.default_branch
|
||||
|
||||
# 访问版本庫后更新project_score表数据;changeset_num为提交总数
|
||||
project_score = @project.project_score
|
||||
if project_score.nil?
|
||||
|
@ -399,23 +383,29 @@ update
|
|||
else
|
||||
project_score.update_column(:changeset_num, @changesets_all_count)
|
||||
end
|
||||
|
||||
unless @changesets_latest_coimmit.blank?
|
||||
update_commits_date(@project, @changesets_latest_coimmit)
|
||||
end
|
||||
|
||||
# 获取版本库目录结构
|
||||
#@entries = @repository.entries(@path, @rev)
|
||||
if request.xhr?
|
||||
#@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
|
||||
else
|
||||
@changesets = @g.commits(@project.gpid, :ref_name => @rev)
|
||||
# 最近一次提交
|
||||
@changesets_latest_coimmit = @changesets[0]
|
||||
g_project = @g.project(@project.gpid)
|
||||
# 总的提交数
|
||||
@changesets_all_count = @g.user_static(@project.gpid, :rev => @rev).count
|
||||
# 获取默认分支
|
||||
@g_default_branch = g_project.default_branch.nil? ? "master" : g_project.default_branch
|
||||
@creator = @project.owner.to_s
|
||||
gitlab_address = Redmine::Configuration['gitlab_address']
|
||||
|
||||
# REDO:需优化,仅测试用
|
||||
@zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token
|
||||
|
||||
# 获取版本库路径,主要分为两种,一种随Gitlab类型,另一种为Git类型,Git类型为无用数据,最终需要删掉这种类型。
|
||||
# if @repository.type.to_s == "Repository::Gitlab"
|
||||
@repos_url = gitlab_address.to_s+"/" + @creator + "/" + @repository.identifier+"."+"git"
|
||||
# else
|
||||
# @repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s + @repository.url.slice(project_path_cut, @repository.url.length).to_s
|
||||
# end
|
||||
render :action => 'show', :layout => 'base_projects'
|
||||
render :layout => 'base_projects'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue