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 %> 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..b99221c83 --- /dev/null +++ b/lib/tasks/sync_sigle_rep.rake @@ -0,0 +1,22 @@ +#coding=utf-8 + +namespace :sync_rep do + desc "sync some projects which just have sigle repository" + task :sigle => :environment do + projects = Project.all + 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 + 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..8c84984ee 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, @@ -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