Class: Commits::ChangeService

Inherits:
BaseService show all
Defined in:
app/services/commits/change_service.rb

Direct Known Subclasses

CherryPickService, RevertService

Defined Under Namespace

Classes: ChangeError, ValidationError

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#abilities, #can?, #deny_visibility_level, #event_service, #initialize, #log_info, #notification_service, #repository, #system_hook_service, #todo_service

Methods included from Gitlab::CurrentSettings

#current_application_settings, #fake_application_settings

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#commitObject

Raises:

  • (NotImplementedError)

19
20
21
# File 'app/services/commits/change_service.rb', line 19

def commit
  raise NotImplementedError
end

#executeObject


6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/services/commits/change_service.rb', line 6

def execute
  @source_project = params[:source_project] || @project
  @target_branch = params[:target_branch]
  @commit = params[:commit]
  @create_merge_request = params[:create_merge_request].present?

  check_push_permissions unless @create_merge_request
  commit
rescue Repository::CommitError, Gitlab::Git::Repository::InvalidBlobName, GitHooksService::PreReceiveError,
       ValidationError, ChangeError => ex
  error(ex.message)
end