Fix Wiki migration task and add more test coverage.

There was an error in the #extract_attributes_from_page method that
caused an exception when checking to see if a page named "Home"
already exists.

The check occurs to handle the renaming of the main index page to
"Home" to match the Gollum standard. If there is already a page
called "Home" then the migrator will leave that page and create
the Index page as usual. Users will need to manually rename their
old "Home" page to something else then rename their "Index" page
to "Home". Fortunately, I would be highly surprised if this case
ever comes up.

I also added more verbosity to the logging so if an error does
occur, it will be easier to track down which Wiki page is causing
the problem.
This commit is contained in:
Dan Knox 2013-03-16 18:01:48 -07:00
parent c367cc5ca6
commit 330fe4162e
3 changed files with 154 additions and 6 deletions

View file

@ -16,5 +16,27 @@ namespace :gitlab 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