Commit 8f1be374 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Bitbucket Wikis import: implementation

The gotcha on our side was that we need to force a Git master
branch. As noted in comment, this would have been automatic were
the proper `GL_REPOSITORY` environment variable set.

Overall everything related to repo initialization and especially imports
is still way to coincidental. It's probable that the upcoming GitLab
version bumps will introduce the refactors we wouldn't do purely on
our side.

--HG--
branch : heptapod
parent 63b489e73372
......@@ -100,10 +100,16 @@ def import_repo_config
end
def import_wiki
# gracinet: this isn't obvious, but BitbucketImport::ProjectCreator,
# the class responsible for repo creations will creates the wiki repo
# *only if* there's no wiki on the Bitbucket side.
# Therefore the condition below effectively avoids a useless and
# doomed import. This is unchanged in Heptapod at this point.
return if project.wiki.repository_exists?
wiki = WikiFormatter.new(project)
gitlab_shell.create_wiki_repository(project)
gitlab_shell.import_wiki_repository(project, wiki)
rescue StandardError => e
errors << { type: :wiki, errors: e.message }
......
......@@ -97,7 +97,17 @@ def create_repository(storage, disk_path, gl_project_path,
end
def import_wiki_repository(project, wiki_formatter)
import_repository(project.repository_storage, wiki_formatter.disk_path, wiki_formatter.import_url, project.wiki.full_path)
if project.mercurial?
import_hg_repository(project.repository_storage, wiki_formatter.disk_path, wiki_formatter.import_url)
# wikis really want to have a "master" branch. The generic hg repo
# importer won't do that because it doesn't send the GL_REPOSITORY
# environment var to the hg process.
# TODO refactor, but only after Heptapod 0.13.0 (too close to take
# any risk with the main import logic).
project.wiki.repository.create_branch("master", "branch/default")
else
import_repository(project.repository_storage, wiki_formatter.disk_path, wiki_formatter.import_url, project.wiki.full_path)
end
end
def import_project_repository(project)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment