diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-01-06 17:05:30 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-01-06 17:05:30 +0300 |
commit | a4b97b2cb61c03d08e25cf2cd7fcbb3f21611350 (patch) | |
tree | 5d19444b07a143eb6cac69f5a64f41792455e40d /app/services | |
parent | 593228ffe3b2e4ff82c4d63e5d5c59b835f70085 (diff) |
Rename source to base to avoid confusion from MR
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/commits/change_service.rb | 10 | ||||
-rw-r--r-- | app/services/compare_service.rb | 12 | ||||
-rw-r--r-- | app/services/files/base_service.rb | 10 | ||||
-rw-r--r-- | app/services/files/create_dir_service.rb | 4 | ||||
-rw-r--r-- | app/services/files/create_service.rb | 6 | ||||
-rw-r--r-- | app/services/files/delete_service.rb | 4 | ||||
-rw-r--r-- | app/services/files/multi_service.rb | 6 | ||||
-rw-r--r-- | app/services/files/update_service.rb | 6 | ||||
-rw-r--r-- | app/services/git_operation_service.rb | 40 |
9 files changed, 49 insertions, 49 deletions
diff --git a/app/services/commits/change_service.rb b/app/services/commits/change_service.rb index 8d1dfbcea7d..1faa052e0ca 100644 --- a/app/services/commits/change_service.rb +++ b/app/services/commits/change_service.rb @@ -4,8 +4,8 @@ module Commits class ChangeError < StandardError; end def execute - @source_project = params[:source_project] || @project - @source_branch = params[:source_branch] + @base_project = params[:base_project] || @project + @base_branch = params[:base_branch] @target_branch = params[:target_branch] @commit = params[:commit] @create_merge_request = params[:create_merge_request].present? @@ -28,7 +28,7 @@ module Commits if @create_merge_request into = @commit.public_send("#{action}_branch_name") - tree_branch = @source_branch + tree_branch = @base_branch else into = tree_branch = @target_branch end @@ -45,8 +45,8 @@ module Commits @commit, into, tree_id, - source_project: @source_project, - source_branch_name: @source_branch) + base_project: @base_project, + base_branch_name: @base_branch) success else diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb index d3d613661a6..2e4f8ee9dc8 100644 --- a/app/services/compare_service.rb +++ b/app/services/compare_service.rb @@ -3,18 +3,18 @@ require 'securerandom' # Compare 2 branches for one repo or between repositories # and return Gitlab::Git::Compare object that responds to commits and diffs class CompareService - attr_reader :source_project, :source_branch_name + attr_reader :base_project, :base_branch_name - def initialize(new_source_project, new_source_branch_name) - @source_project = new_source_project - @source_branch_name = new_source_branch_name + def initialize(new_base_project, new_base_branch_name) + @base_project = new_base_project + @base_branch_name = new_base_branch_name end def execute(target_project, target_branch, straight: false) # If compare with other project we need to fetch ref first target_project.repository.with_repo_branch_commit( - source_project.repository, - source_branch_name) do |commit| + base_project.repository, + base_branch_name) do |commit| break unless commit compare(commit.sha, target_project, target_branch, straight) diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb index 80e1d1d60f2..89f7dcbaa87 100644 --- a/app/services/files/base_service.rb +++ b/app/services/files/base_service.rb @@ -3,8 +3,8 @@ module Files class ValidationError < StandardError; end def execute - @source_project = params[:source_project] || @project - @source_branch = params[:source_branch] + @base_project = params[:base_project] || @project + @base_branch = params[:base_branch] @target_branch = params[:target_branch] @commit_message = params[:commit_message] @@ -22,7 +22,7 @@ module Files # Validate parameters validate - # Create new branch if it different from source_branch + # Create new branch if it different from base_branch validate_target_branch if different_branch? result = commit @@ -38,7 +38,7 @@ module Files private def different_branch? - @source_branch != @target_branch || @source_project != @project + @base_branch != @target_branch || @base_project != @project end def file_has_changed? @@ -59,7 +59,7 @@ module Files end unless project.empty_repo? - unless @source_project.repository.branch_exists?(@source_branch) + unless @base_project.repository.branch_exists?(@base_branch) raise_error('You can only create or edit files when you are on a branch') end diff --git a/app/services/files/create_dir_service.rb b/app/services/files/create_dir_service.rb index ee4e130a38f..53b6d456e0d 100644 --- a/app/services/files/create_dir_service.rb +++ b/app/services/files/create_dir_service.rb @@ -8,8 +8,8 @@ module Files branch_name: @target_branch, author_email: @author_email, author_name: @author_name, - source_project: @source_project, - source_branch_name: @source_branch) + base_project: @base_project, + base_branch_name: @base_branch) end def validate diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb index 853c471666d..270dc6471aa 100644 --- a/app/services/files/create_service.rb +++ b/app/services/files/create_service.rb @@ -10,8 +10,8 @@ module Files update: false, author_email: @author_email, author_name: @author_name, - source_project: @source_project, - source_branch_name: @source_branch) + base_project: @base_project, + base_branch_name: @base_branch) end def validate @@ -34,7 +34,7 @@ module Files unless project.empty_repo? @file_path.slice!(0) if @file_path.start_with?('/') - blob = repository.blob_at_branch(@source_branch, @file_path) + blob = repository.blob_at_branch(@base_branch, @file_path) if blob raise_error('Your changes could not be committed because a file with the same name already exists') diff --git a/app/services/files/delete_service.rb b/app/services/files/delete_service.rb index cfe532d49b3..d5341b9e197 100644 --- a/app/services/files/delete_service.rb +++ b/app/services/files/delete_service.rb @@ -8,8 +8,8 @@ module Files branch_name: @target_branch, author_email: @author_email, author_name: @author_name, - source_project: @source_project, - source_branch_name: @source_branch) + base_project: @base_project, + base_branch_name: @base_branch) end end end diff --git a/app/services/files/multi_service.rb b/app/services/files/multi_service.rb index f77e5d91103..ca13b887e06 100644 --- a/app/services/files/multi_service.rb +++ b/app/services/files/multi_service.rb @@ -10,8 +10,8 @@ module Files actions: params[:actions], author_email: @author_email, author_name: @author_name, - source_project: @source_project, - source_branch_name: @source_branch + base_project: @base_project, + base_branch_name: @base_branch ) end @@ -63,7 +63,7 @@ module Files end def last_commit - Gitlab::Git::Commit.last_for_path(repository, @source_branch, @file_path) + Gitlab::Git::Commit.last_for_path(repository, @base_branch, @file_path) end def regex_check(file) diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb index 5f671817cdb..f546b169550 100644 --- a/app/services/files/update_service.rb +++ b/app/services/files/update_service.rb @@ -9,8 +9,8 @@ module Files previous_path: @previous_path, author_email: @author_email, author_name: @author_name, - source_project: @source_project, - source_branch_name: @source_branch) + base_project: @base_project, + base_branch_name: @base_branch) end private @@ -25,7 +25,7 @@ module Files def last_commit @last_commit ||= Gitlab::Git::Commit. - last_for_path(@source_project.repository, @source_branch, @file_path) + last_for_path(@base_project.repository, @base_branch, @file_path) end end end diff --git a/app/services/git_operation_service.rb b/app/services/git_operation_service.rb index 3b7f702e3ab..ec23407544c 100644 --- a/app/services/git_operation_service.rb +++ b/app/services/git_operation_service.rb @@ -46,23 +46,23 @@ class GitOperationService end end - # Whenever `source_branch_name` is passed, if `branch_name` doesn't exist, - # it would be created from `source_branch_name`. - # If `source_project` is passed, and the branch doesn't exist, - # it would try to find the source from it instead of current repository. + # Whenever `base_branch_name` is passed, if `branch_name` doesn't exist, + # it would be created from `base_branch_name`. + # If `base_project` is passed, and the branch doesn't exist, + # it would try to find the base from it instead of current repository. def with_branch( branch_name, - source_branch_name: nil, - source_project: repository.project, + base_branch_name: nil, + base_project: repository.project, &block) check_with_branch_arguments!( - branch_name, source_branch_name, source_project) + branch_name, base_branch_name, base_project) update_branch_with_hooks(branch_name) do repository.with_repo_branch_commit( - source_project.repository, - source_branch_name || branch_name, + base_project.repository, + base_branch_name || branch_name, &block) end end @@ -148,27 +148,27 @@ class GitOperationService end def check_with_branch_arguments!( - branch_name, source_branch_name, source_project) + branch_name, base_branch_name, base_project) return if repository.branch_exists?(branch_name) - if repository.project != source_project - unless source_branch_name + if repository.project != base_project + unless base_branch_name raise ArgumentError, - 'Should also pass :source_branch_name if' + - ' :source_project is different from current project' + 'Should also pass :base_branch_name if' + + ' :base_project is different from current project' end - unless source_project.repository.branch_exists?(source_branch_name) + unless base_project.repository.branch_exists?(base_branch_name) raise ArgumentError, "Cannot find branch #{branch_name} nor" \ - " #{source_branch_name} from" \ - " #{source_project.path_with_namespace}" + " #{base_branch_name} from" \ + " #{base_project.path_with_namespace}" end - elsif source_branch_name - unless repository.branch_exists?(source_branch_name) + elsif base_branch_name + unless repository.branch_exists?(base_branch_name) raise ArgumentError, "Cannot find branch #{branch_name} nor" \ - " #{source_branch_name} from" \ + " #{base_branch_name} from" \ " #{repository.project.path_with_namespace}" end end |