mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-20 11:45:57 +08:00
Merge remote-tracking branch 'origin/develop' into standalone_develop
This commit is contained in:
@@ -13,7 +13,6 @@ class Api::V1::Projects::Contents::BatchCreateService < ApplicationService
|
||||
|
||||
|
||||
def initialize(project, params, token=nil)
|
||||
puts params
|
||||
@project = project
|
||||
@owner = project&.owner.login
|
||||
@repo = project&.identifier
|
||||
@@ -21,11 +20,11 @@ class Api::V1::Projects::Contents::BatchCreateService < ApplicationService
|
||||
@files = params[:files]
|
||||
@author_email = params[:author_email]
|
||||
@author_name = params[:author_name]
|
||||
@author_timeunix = params[:author_timeunix]
|
||||
@author_timeunix = params[:author_timeunix] || Time.now.to_i
|
||||
@branch = params[:branch]
|
||||
@committer_email = params[:committer_email]
|
||||
@committer_name = params[:committer_name]
|
||||
@committer_timeunix = params[:committer_timeunix]
|
||||
@committer_timeunix = params[:committer_timeunix] || Time.now.to_i
|
||||
@message = params[:message]
|
||||
@new_branch = params[:new_branch]
|
||||
end
|
||||
@@ -63,6 +62,7 @@ class Api::V1::Projects::Contents::BatchCreateService < ApplicationService
|
||||
committer: Time.at(committer_timeunix.to_i)
|
||||
},
|
||||
message: message,
|
||||
branch: branch,
|
||||
new_branch: new_branch,
|
||||
signoff: false
|
||||
}
|
||||
@@ -77,15 +77,16 @@ class Api::V1::Projects::Contents::BatchCreateService < ApplicationService
|
||||
end
|
||||
|
||||
def excute_data_to_gitea
|
||||
puts request_body.to_json
|
||||
@gitea_data = $gitea_client.post_repos_contents_batch_by_owner_repo(owner, repo, {body: request_body.to_json, query: request_params}) rescue nil
|
||||
raise Error, '创建文件失败!' unless @gitea_data.is_a?(Hash)
|
||||
raise Error, '提交文件失败!' unless @gitea_data.is_a?(Hash)
|
||||
end
|
||||
|
||||
def check_branch_exist
|
||||
result = $gitea_client.get_repos_branch_name_set_by_owner_repo(owner, repo, {query: request_params} ) rescue nil
|
||||
raise Error, '查询分支名称失败!' unless result.is_a?(Hash)
|
||||
raise Error, '分支不存在!' unless result['branch_name'].include?(branch)
|
||||
raise Error, '分支已存在!' if result['branch_name'].include?(new_branch) && new_branch.nil?
|
||||
raise Error, '分支已存在!' if result['branch_name'].include?(new_branch) && !new_branch.nil?
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user