添加历史记录迁移

This commit is contained in:
huang 2015-11-02 17:36:45 +08:00
parent 4d5d012ecf
commit 36d61cd82f
2 changed files with 22 additions and 12 deletions

View File

@ -215,11 +215,11 @@ update
end
end
unless @repository.gitlab?
# redirect_to to_gitlab_project_repository_path(@project, @repository)
render :to_gitlab
return
end
# unless @repository.gitlab?
# # redirect_to to_gitlab_project_repository_path(@project, @repository)
# render :to_gitlab
# return
# end
#if( !User.current.member_of?(@project) || @project.hidden_repo)
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
@ -254,15 +254,9 @@ update
gitlab_address = Redmine::Configuration['gitlab_address']
if @repository.type.to_s == "Repository::Gitlab"
@repos_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+@repository.identifier+"."+"git"
else
# 默认选择历史版本库情况
rep = Repository.where("project_id =? and type =?", @project, "Repository::Gitlab")
unless rep.blank?
@repos_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+rep.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
end
if @course_tag == 1
render :action => 'show', :layout => 'base_courses'
else

View File

@ -0,0 +1,16 @@
#coding=utf-8
namespace :rep_fault do
desc "update fault rep"
task :rep_update => :environment do
Project.all.each do |project|
if project.repositories.count > 0
unless Repository.where("project_id =? and type = ?",project, "Repository::Gitlab").blank?
project.repositories.each do |repository|
repository.update_attributes(:is_default => true)
end
end
end
end
end
end