From a996e658a9d8b074bd6f3c4bf4d2f1699a069157 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 4 Nov 2015 14:50:39 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=8D=95=E4=B8=AA=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93=E8=87=AA=E5=8A=A8=E5=90=8C=E6=AD=A5=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e_rep_if_fault.rake => gitlab_to_git.rake} | 0 lib/tasks/sync_sigle_rep.rake | 24 +++++++++++++++++++ lib/trustie/gitlab/sync.rb | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) rename lib/tasks/{update_rep_if_fault.rake => gitlab_to_git.rake} (100%) create mode 100644 lib/tasks/sync_sigle_rep.rake diff --git a/lib/tasks/update_rep_if_fault.rake b/lib/tasks/gitlab_to_git.rake similarity index 100% rename from lib/tasks/update_rep_if_fault.rake rename to lib/tasks/gitlab_to_git.rake diff --git a/lib/tasks/sync_sigle_rep.rake b/lib/tasks/sync_sigle_rep.rake new file mode 100644 index 000000000..6b7be700f --- /dev/null +++ b/lib/tasks/sync_sigle_rep.rake @@ -0,0 +1,24 @@ +#coding=utf-8 + +namespace :sync_rep do + desc "sync some projects which just have sigle repository" + task :sigle => :environment do + projects = Project.where("id =?",24) + projects.each do |project| + # 针对类型为Git并且只有一个版本库的项目 + if project.repositories && project.repositories.count == 1 && project.repositories.first.type == "Repository::Git" + rep = project.repositories.first + 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 + puts rep.url + puts project.user_id + 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 3a8e8380c..de4bec70b 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -66,7 +66,7 @@ module Trustie if opt[:password] import_url.sub('@', ":#{opt[:password]}@") end - + # import url http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git # can use password gproject = self.g.create_project(path, From 58b7250d39ea64dc76789c3e77a0df4ad64912db Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 4 Nov 2015 16:19:25 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=A1=B9=E7=9B=AE=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5=E5=8F=82=E6=95=B0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_sigle_rep.rake | 4 +--- lib/trustie/gitlab/sync.rb | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/tasks/sync_sigle_rep.rake b/lib/tasks/sync_sigle_rep.rake index 6b7be700f..b99221c83 100644 --- a/lib/tasks/sync_sigle_rep.rake +++ b/lib/tasks/sync_sigle_rep.rake @@ -3,7 +3,7 @@ namespace :sync_rep do desc "sync some projects which just have sigle repository" task :sigle => :environment do - projects = Project.where("id =?",24) + projects = Project.all projects.each do |project| # 针对类型为Git并且只有一个版本库的项目 if project.repositories && project.repositories.count == 1 && project.repositories.first.type == "Repository::Git" @@ -16,8 +16,6 @@ namespace :sync_rep do puts project.id puts rep.id puts rep.identifier - puts rep.url - puts project.user_id end end end diff --git a/lib/trustie/gitlab/sync.rb b/lib/trustie/gitlab/sync.rb index de4bec70b..8c84984ee 100644 --- a/lib/trustie/gitlab/sync.rb +++ b/lib/trustie/gitlab/sync.rb @@ -76,6 +76,7 @@ module Trustie wall_enabled: false, issues_enabled: false, snippets_enabled: false, + merge_requests_enabled: true, public: false, user_id: gid, import_url: import_url From 496aeb4456095dc03af7785a164c6f82885226bf Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 4 Nov 2015 16:23:08 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E2=80=9C=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_development_group.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index e51683295..ec8562885 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -49,7 +49,7 @@ <% end %> (<%= @project.repositories.count %>) <% if (User.current.admin? || User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) && rep_is_gitlab?(@project) %> - <%= link_to "+"+l(:project_module_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %> + <%= link_to "+"+l(:project_gitlab_create_repository), url_for(:controller => 'projects', :action => 'settings', :id => @project.id, :tab=>'repositories') , :class => "subnav_green" %> <% end %> <% end %>