去掉同步过程中输出

hjq_course
huang 10 years ago
parent 913c202536
commit 55d3b8abb3

@ -12,45 +12,15 @@ namespace :sync_rep do
puts count puts count
unless count > 1 unless count > 1
rep.identifier rep.identifier
puts "################################"
puts project.id
puts rep.id
s = Trustie::Gitlab::Sync.new s = Trustie::Gitlab::Sync.new
s.sync_project(project, path: rep.identifier, import_url: rep.url) s.sync_project(project, path: rep.identifier, import_url: rep.url)
rep.type = 'Repository::Gitlab' rep.type = 'Repository::Gitlab'
rep.save rep.save
puts "*************************************"
puts project.id
puts rep.id
puts rep.identifier
end end
end end
end end
end end
task :delete_rep => :environment do task :delete_rep => :environment do
projects = Project.where("user_id !=?",12)
projects.each do |project|
# 针对类型为Git并且只有一个版本库的项目
if project.repositories && project.repositories.count == 1 && project.repositories.first.type == "Repository::Git"
rep = project.repositories.first
count = Repository.find_by_sql("SELECT * FROM `repositories` where identifier = '#{rep.identifier}'").count
puts count
unless count > 1
rep.identifier
puts "################################"
puts project.id
puts rep.id
s = Trustie::Gitlab::Sync.new
s.sync_project(project, path: rep.identifier, import_url: rep.url)
rep.type = 'Repository::Gitlab'
rep.save
puts "*************************************"
puts project.id
puts rep.id
puts rep.identifier
end
end
end
end end
end end

@ -73,11 +73,6 @@ module Trustie
# import url http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git # import url http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git
# can use password # can use password
puts "@@@@@@@@@@@@@@@@@@@@@@@"
puts path
puts project.description
puts gid
puts import_url
gproject = self.g.create_project(path, gproject = self.g.create_project(path,
path: path, path: path,
description: project.description, description: project.description,
@ -91,7 +86,6 @@ module Trustie
import_url: import_url, import_url: import_url,
visibility_level: project.is_public? ? UserLevel::PUBLIC : UserLevel::PRIVATE visibility_level: project.is_public? ? UserLevel::PUBLIC : UserLevel::PRIVATE
) )
puts "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
project.gpid = gproject.id project.gpid = gproject.id
project.save! project.save!
puts "Successfully created #{project.name}" puts "Successfully created #{project.name}"

Loading…
Cancel
Save