shixun模块版本库创建事务一致性处理
This commit is contained in:
parent
fbc52a7892
commit
0298c45b20
|
@ -361,22 +361,23 @@ update
|
|||
@repository.url = @repository.identifier
|
||||
@repository.project_id = -1
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
if request.post? && @repository.save
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
s.create_shixun(@shixun, @repository)
|
||||
raise "sync failed" if @shixun.gpid.blank?
|
||||
redirect_to(:controller => 'repositories', :action => 'shixun_show', :shixun_id => @shixun, :identifier => @repository.try(:identifier))
|
||||
begin
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
gproject = s.create_shixun(@shixun, @repository)
|
||||
raise "sync failed" if @shixun.gpid.blank?
|
||||
redirect_to(:controller => 'repositories', :action => 'shixun_show', :shixun_id => @shixun, :identifier => @repository.try(:identifier))
|
||||
rescue Exception => e
|
||||
@shixun.update_attribute(:gpid, nil)
|
||||
if @repository.id
|
||||
@repository.destroy
|
||||
end
|
||||
end
|
||||
else
|
||||
redirect_to settings_shixun_url(@shixun, :tab => 'repositories',:repository_error_message => @repository.errors.full_messages)
|
||||
respond_to do |format|
|
||||
format.js{flash[:notice] = "版本库创建失败"}
|
||||
end
|
||||
end
|
||||
rescue Gitlab::Error::Forbidden => e
|
||||
@message = l(:label_pull_request_forbidden)
|
||||
rescue Gitlab::Error::NotFound => e
|
||||
@message = l(:label_pull_request_notfound)
|
||||
rescue Exception => e
|
||||
puts e
|
||||
end
|
||||
end
|
||||
elsif @project
|
||||
# 判断版本库创建者是否有同名版本库,避免版本库路径一致问题
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
|
||||
function project_repository_commit()
|
||||
{
|
||||
if(regex_repoistory_name())
|
||||
// if(regex_repoistory_name())
|
||||
{
|
||||
$("#new_repository").submit();
|
||||
}
|
||||
|
|
|
@ -38,10 +38,6 @@
|
|||
<li id="project_menu_011">
|
||||
<%= link_to 1 > 0 ? "#{l(:project_module_training_tasks)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k 99999}</span>".html_safe : "#{l(:project_module_training_tasks)}", shixun_challenges_url(@shixun), :class => "pro_new_proname", :title => "#{99999}" %>
|
||||
</li>
|
||||
<!--讨论区-->
|
||||
<li id="project_menu_03">
|
||||
<%= link_to 1 > 0 ? "#{l(:project_module_boards)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k 99999}</span>".html_safe : "#{l(:project_module_boards)}", project_boards_path(@shixun), :class => "pro_new_proname", :title => "#{99999}" %>
|
||||
</li>
|
||||
|
||||
<!--版本库-->
|
||||
<% unless @shixun.repository.nil? %>
|
||||
|
|
Loading…
Reference in New Issue