Class: Projects::OverwriteProjectService
- Inherits:
-
BaseService
- Object
- BaseService
- Projects::OverwriteProjectService
- Defined in:
- app/services/projects/overwrite_project_service.rb
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
Methods inherited from BaseService
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from BaseService
Instance Method Details
#execute(source_project) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/services/projects/overwrite_project_service.rb', line 5 def execute(source_project) return unless source_project && source_project.namespace == @project.namespace Project.transaction do move_before_destroy_relationships(source_project) # Reset is required in order to get the proper # uncached fork network method calls value. destroy_old_project(source_project.reset) rename_project(source_project.name, source_project.path) @project end # Projects::DestroyService can raise Exceptions, but we don't want # to pass that kind of exception to the caller. Instead, we change it # for a StandardError exception rescue Exception => e # rubocop:disable Lint/RescueException attempt_restore_repositories(source_project) if e.class == Exception raise StandardError, e. else raise end end |