From 0da5a4fab136158f9a51de1f92f74ebd9ea922a2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 5 Apr 2013 20:44:16 +0300 Subject: [PATCH] separate rake task for migration and persistent one --- lib/tasks/gitlab/migrate_wiki.rake | 42 ------------------------------------------ lib/tasks/migrate/migrate_mr.rake | 11 +++++++++++ lib/tasks/migrate/migrate_wiki.rake | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 42 deletions(-) delete mode 100644 lib/tasks/gitlab/migrate_wiki.rake create mode 100644 lib/tasks/migrate/migrate_mr.rake create mode 100644 lib/tasks/migrate/migrate_wiki.rake diff --git a/lib/tasks/gitlab/migrate_wiki.rake b/lib/tasks/gitlab/migrate_wiki.rake deleted file mode 100644 index 5d9881e..0000000 --- a/lib/tasks/gitlab/migrate_wiki.rake +++ /dev/null @@ -1,42 +0,0 @@ -namespace :gitlab do - namespace :wiki do - - # This task will migrate all of the existing Wiki - # content stored in your database into the new - # Gollum Wiki system. A new repository named - # namespace/project.wiki.git will be created for - # each project that currently has Wiki pages in - # the database. - # - # Notes: - # * The existing Wiki content will remain in your - # database in-tact. - desc "GITLAB | Migrate Wiki content from database to Gollum repositories." - task :migrate => :environment do - wiki_migrator = WikiToGollumMigrator.new - wiki_migrator.migrate! - end - - # This task will destroy all of the Wiki repos - # that the Wiki migration task created. Run this - # to clean up your environment if you experienced - # problems during the original migration. After - # executing this task, you can attempt the original - # migration again. - # - # Notes: - # * This will not affect Wikis that have been created - # as Gollum Wikis only. It will only remove the wikis - # for the repositories that have old Wiki data in the - # dataabase. - # * If you have any repositories already named - # namespace/project.wiki that you do not wish - # to be removed you may want to perform a manual - # cleanup instead. - desc "GITLAB | Remove the Wiki repositories created by the `gitlab:wiki:migrate` task." - task :rollback => :environment do - wiki_migrator = WikiToGollumMigrator.new - wiki_migrator.rollback! - end - end -end diff --git a/lib/tasks/migrate/migrate_mr.rake b/lib/tasks/migrate/migrate_mr.rake new file mode 100644 index 0000000..6c2312b --- /dev/null +++ b/lib/tasks/migrate/migrate_mr.rake @@ -0,0 +1,11 @@ +# This taks will reload commits/diff for all merge requests +desc "GITLAB | Migrate Merge Requests" +task migrate_merge_requests: :environment do + MergeRequest.find_each(batch_size: 20) do |mr| + mr.st_commits = [] + mr.save + mr.reload_code + print '.' + end +end + diff --git a/lib/tasks/migrate/migrate_wiki.rake b/lib/tasks/migrate/migrate_wiki.rake new file mode 100644 index 0000000..5d9881e --- /dev/null +++ b/lib/tasks/migrate/migrate_wiki.rake @@ -0,0 +1,42 @@ +namespace :gitlab do + namespace :wiki do + + # This task will migrate all of the existing Wiki + # content stored in your database into the new + # Gollum Wiki system. A new repository named + # namespace/project.wiki.git will be created for + # each project that currently has Wiki pages in + # the database. + # + # Notes: + # * The existing Wiki content will remain in your + # database in-tact. + desc "GITLAB | Migrate Wiki content from database to Gollum repositories." + task :migrate => :environment do + wiki_migrator = WikiToGollumMigrator.new + wiki_migrator.migrate! + end + + # This task will destroy all of the Wiki repos + # that the Wiki migration task created. Run this + # to clean up your environment if you experienced + # problems during the original migration. After + # executing this task, you can attempt the original + # migration again. + # + # Notes: + # * This will not affect Wikis that have been created + # as Gollum Wikis only. It will only remove the wikis + # for the repositories that have old Wiki data in the + # dataabase. + # * If you have any repositories already named + # namespace/project.wiki that you do not wish + # to be removed you may want to perform a manual + # cleanup instead. + desc "GITLAB | Remove the Wiki repositories created by the `gitlab:wiki:migrate` task." + task :rollback => :environment do + wiki_migrator = WikiToGollumMigrator.new + wiki_migrator.rollback! + end + end +end -- libgit2 0.21.2