forked from Gitlink/forgeplus
fix: migrate use old rule
This commit is contained in:
parent
298abdd1b1
commit
29dc3fff39
|
@ -59,23 +59,23 @@ class ProjectsController < ApplicationController
|
|||
Projects::MigrateForm.new(mirror_params).validate!
|
||||
|
||||
@project =
|
||||
# if enable_accelerator?(mirror_params[:clone_addr])
|
||||
# source_clone_url = mirror_params[:clone_addr]
|
||||
# uid_logger("########## 已动加速器 ##########")
|
||||
# result = Gitea::Accelerator::MigrateService.call(mirror_params)
|
||||
# if result[:status] == :success
|
||||
# Rails.logger.info "########## 加速镜像成功 ########## "
|
||||
# Projects::MigrateService.call(current_user,
|
||||
# mirror_params.merge(source_clone_url: source_clone_url,
|
||||
# clone_addr: accelerator_url(mirror_params[:repository_name])))
|
||||
# else
|
||||
# Projects::MigrateService.call(current_user, mirror_params)
|
||||
# end
|
||||
if mirror_params[:clone_addr].include?("github.com")
|
||||
if enable_accelerator?(mirror_params[:clone_addr])
|
||||
source_clone_url = mirror_params[:clone_addr]
|
||||
clone_url = source_clone_url.gsub('github.com', 'github.com.cnpmjs.org')
|
||||
uid_logger("########## 更改clone_addr ##########")
|
||||
Projects::MigrateService.call(current_user, mirror_params.merge(source_clone_url: source_clone_url, clone_addr: clone_url))
|
||||
uid_logger("########## 已动加速器 ##########")
|
||||
result = Gitea::Accelerator::MigrateService.call(mirror_params)
|
||||
if result[:status] == :success
|
||||
Rails.logger.info "########## 加速镜像成功 ########## "
|
||||
Projects::MigrateService.call(current_user,
|
||||
mirror_params.merge(source_clone_url: source_clone_url,
|
||||
clone_addr: accelerator_url(mirror_params[:repository_name])))
|
||||
else
|
||||
Projects::MigrateService.call(current_user, mirror_params)
|
||||
end
|
||||
# if mirror_params[:clone_addr].include?("github.com")
|
||||
# source_clone_url = mirror_params[:clone_addr]
|
||||
# clone_url = source_clone_url.gsub('github.com', 'github.com.cnpmjs.org')
|
||||
# uid_logger("########## 更改clone_addr ##########")
|
||||
# Projects::MigrateService.call(current_user, mirror_params.merge(source_clone_url: source_clone_url, clone_addr: clone_url))
|
||||
else
|
||||
Projects::MigrateService.call(current_user, mirror_params)
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class Ci::Repo < Ci::RemoteBase
|
|||
def self.find_with_namespace(namespace_path, identifier, user_login)
|
||||
logger.info "########namespace_path: #{namespace_path} ########identifier: #{identifier} "
|
||||
user_login = user_login || namespace_path
|
||||
user = Ci::User.find_by_user_login user_login
|
||||
user = Ci::User.find_by(user_login: user_login)
|
||||
repo = Ci::Repo.where(repo_namespace: namespace_path, repo_name: identifier).first
|
||||
|
||||
[user, repo]
|
||||
|
|
Loading…
Reference in New Issue