diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /lib/gitlab/legacy_github_import | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'lib/gitlab/legacy_github_import')
-rw-r--r-- | lib/gitlab/legacy_github_import/client.rb | 14 | ||||
-rw-r--r-- | lib/gitlab/legacy_github_import/project_creator.rb | 10 |
2 files changed, 19 insertions, 5 deletions
diff --git a/lib/gitlab/legacy_github_import/client.rb b/lib/gitlab/legacy_github_import/client.rb index 7d78c8dee25..dd1502bbbcd 100644 --- a/lib/gitlab/legacy_github_import/client.rb +++ b/lib/gitlab/legacy_github_import/client.rb @@ -79,6 +79,20 @@ module Gitlab @users[login] = api.user(login) end + def repository(id) + request(:repository, id).to_h + end + + def repos + repositories = request(:repos, nil) + + if repositories.is_a?(Array) + repositories.map(&:to_h) + else + repositories + end + end + private def api_endpoint diff --git a/lib/gitlab/legacy_github_import/project_creator.rb b/lib/gitlab/legacy_github_import/project_creator.rb index c54325bcdf5..01e04fa9c81 100644 --- a/lib/gitlab/legacy_github_import/project_creator.rb +++ b/lib/gitlab/legacy_github_import/project_creator.rb @@ -18,11 +18,11 @@ module Gitlab attrs = { name: name, path: name, - description: repo.description, + description: repo[:description], namespace_id: namespace.id, visibility_level: visibility_level, import_type: type, - import_source: repo.full_name, + import_source: repo[:full_name], import_url: import_url, skip_wiki: skip_wiki }.merge!(extra_attrs) @@ -33,11 +33,11 @@ module Gitlab private def import_url - repo.clone_url.sub('://', "://#{session_data[:github_access_token]}@") + repo[:clone_url].sub('://', "://#{session_data[:github_access_token]}@") end def visibility_level - visibility_level = repo.private ? Gitlab::VisibilityLevel::PRIVATE : @namespace.visibility_level + visibility_level = repo[:private] ? Gitlab::VisibilityLevel::PRIVATE : @namespace.visibility_level visibility_level = Gitlab::CurrentSettings.default_project_visibility if Gitlab::CurrentSettings.restricted_visibility_levels.include?(visibility_level) visibility_level @@ -49,7 +49,7 @@ module Gitlab # repository already exist. # def skip_wiki - repo.has_wiki? + repo[:has_wiki] end end end |