|
|
|
@ -3,7 +3,8 @@ namespace :gitlab do
|
|
|
|
|
task :forge_acts => :environment do
|
|
|
|
|
begin
|
|
|
|
|
g = Gitlab.client
|
|
|
|
|
projects = Project.find_by_sql("select * from projects where gpid is not null")
|
|
|
|
|
# projects = Project.find_by_sql("select * from projects where gpid is not null")
|
|
|
|
|
projects = Project.find("select * from projects where gpid is not null and id != 2")
|
|
|
|
|
projects.each do |project|
|
|
|
|
|
g_project = g.project(project.gpid)
|
|
|
|
|
# 获取默认分支
|
|
|
|
@ -15,7 +16,7 @@ namespace :gitlab do
|
|
|
|
|
(0..pages).each do |page|
|
|
|
|
|
commits = g.commits(project.gpid, :ref_name => g_default_branch, :page => page)
|
|
|
|
|
commits.each do |commit|
|
|
|
|
|
Changeset.create(:project_id => project.id, :repository_id => project.gpid, :revision => commit.id, :committer => commit.author_email, :comments => Redmine::CodesetUtil.to_utf8(commit.title, 'UTF-8'), :committed_on => commit.created_at)
|
|
|
|
|
Changeset.create(:project_id => project.id, :repository_id => project.gpid, :revision => commit.id, :committer => commit.author_email, :comments => Redmine::CodesetUtil.to_utf8(commit.title, 'UTF-8'), :committed_on => commit.created_at, :type => true)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|