From 55d3b8abb3dcb64696f2866da4f7634b3e49ed28 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 16 Nov 2015 17:19:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=90=8C=E6=AD=A5=E8=BF=87?= =?UTF-8?q?=E7=A8=8B=E4=B8=AD=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_sigle_rep.rake | 30 ------------------------------ lib/trustie/gitlab/sync.rb | 6 ------ 2 files changed, 36 deletions(-) diff --git a/lib/tasks/sync_sigle_rep.rake b/lib/tasks/sync_sigle_rep.rake index 4ed360426..e68e37ee8 100644 --- a/lib/tasks/sync_sigle_rep.rake +++ b/lib/tasks/sync_sigle_rep.rake @@ -12,45 +12,15 @@ namespace :sync_rep do 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 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 \ No newline at end of file diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb index ac01a44ec..1f6f7c146 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -73,11 +73,6 @@ module Trustie # import url http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git # can use password - puts "@@@@@@@@@@@@@@@@@@@@@@@" - puts path - puts project.description - puts gid - puts import_url gproject = self.g.create_project(path, path: path, description: project.description, @@ -91,7 +86,6 @@ module Trustie import_url: import_url, visibility_level: project.is_public? ? UserLevel::PUBLIC : UserLevel::PRIVATE ) - puts "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" project.gpid = gproject.id project.save! puts "Successfully created #{project.name}"