Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-01-06 18:29:13 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-01-06 18:29:13 +0300
commitccc73c455ba0b95b531c69414a6a1f47667f16b5 (patch)
tree914207fd6b9672bf2a46ea4b37c59b37444a4d91 /app/services
parente3c36850a618ee2f7f9087b681e62d8a50e7b1b1 (diff)
Rename from base to start because base could mean merge base
Diffstat (limited to 'app/services')
-rw-r--r--app/services/commits/change_service.rb10
-rw-r--r--app/services/compare_service.rb12
-rw-r--r--app/services/files/base_service.rb10
-rw-r--r--app/services/files/create_dir_service.rb4
-rw-r--r--app/services/files/create_service.rb6
-rw-r--r--app/services/files/delete_service.rb4
-rw-r--r--app/services/files/multi_service.rb6
-rw-r--r--app/services/files/update_service.rb6
-rw-r--r--app/services/git_operation_service.rb40
9 files changed, 49 insertions, 49 deletions
diff --git a/app/services/commits/change_service.rb b/app/services/commits/change_service.rb
index 1faa052e0ca..25e22f14e60 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
- @base_project = params[:base_project] || @project
- @base_branch = params[:base_branch]
+ @start_project = params[:start_project] || @project
+ @start_branch = params[:start_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 = @base_branch
+ tree_branch = @start_branch
else
into = tree_branch = @target_branch
end
@@ -45,8 +45,8 @@ module Commits
@commit,
into,
tree_id,
- base_project: @base_project,
- base_branch_name: @base_branch)
+ start_project: @start_project,
+ start_branch_name: @start_branch)
success
else
diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb
index 2e4f8ee9dc8..ab4c02a97a0 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 :base_project, :base_branch_name
+ attr_reader :start_project, :start_branch_name
- def initialize(new_base_project, new_base_branch_name)
- @base_project = new_base_project
- @base_branch_name = new_base_branch_name
+ def initialize(new_start_project, new_start_branch_name)
+ @start_project = new_start_project
+ @start_branch_name = new_start_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(
- base_project.repository,
- base_branch_name) do |commit|
+ start_project.repository,
+ start_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 89f7dcbaa87..0a25f56d24c 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
- @base_project = params[:base_project] || @project
- @base_branch = params[:base_branch]
+ @start_project = params[:start_project] || @project
+ @start_branch = params[:start_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 base_branch
+ # Create new branch if it different from start_branch
validate_target_branch if different_branch?
result = commit
@@ -38,7 +38,7 @@ module Files
private
def different_branch?
- @base_branch != @target_branch || @base_project != @project
+ @start_branch != @target_branch || @start_project != @project
end
def file_has_changed?
@@ -59,7 +59,7 @@ module Files
end
unless project.empty_repo?
- unless @base_project.repository.branch_exists?(@base_branch)
+ unless @start_project.repository.branch_exists?(@start_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 53b6d456e0d..858de5f0538 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,
- base_project: @base_project,
- base_branch_name: @base_branch)
+ start_project: @start_project,
+ start_branch_name: @start_branch)
end
def validate
diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb
index 270dc6471aa..88dd7bbaedb 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,
- base_project: @base_project,
- base_branch_name: @base_branch)
+ start_project: @start_project,
+ start_branch_name: @start_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(@base_branch, @file_path)
+ blob = repository.blob_at_branch(@start_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 d5341b9e197..50f0ffcac9f 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,
- base_project: @base_project,
- base_branch_name: @base_branch)
+ start_project: @start_project,
+ start_branch_name: @start_branch)
end
end
end
diff --git a/app/services/files/multi_service.rb b/app/services/files/multi_service.rb
index ca13b887e06..6ba868df04d 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,
- base_project: @base_project,
- base_branch_name: @base_branch
+ start_project: @start_project,
+ start_branch_name: @start_branch
)
end
@@ -63,7 +63,7 @@ module Files
end
def last_commit
- Gitlab::Git::Commit.last_for_path(repository, @base_branch, @file_path)
+ Gitlab::Git::Commit.last_for_path(repository, @start_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 f546b169550..a71fe61a4b6 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,
- base_project: @base_project,
- base_branch_name: @base_branch)
+ start_project: @start_project,
+ start_branch_name: @start_branch)
end
private
@@ -25,7 +25,7 @@ module Files
def last_commit
@last_commit ||= Gitlab::Git::Commit.
- last_for_path(@base_project.repository, @base_branch, @file_path)
+ last_for_path(@start_project.repository, @start_branch, @file_path)
end
end
end
diff --git a/app/services/git_operation_service.rb b/app/services/git_operation_service.rb
index ec23407544c..2b2ba0870a4 100644
--- a/app/services/git_operation_service.rb
+++ b/app/services/git_operation_service.rb
@@ -46,23 +46,23 @@ class GitOperationService
end
end
- # 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.
+ # Whenever `start_branch_name` is passed, if `branch_name` doesn't exist,
+ # it would be created from `start_branch_name`.
+ # If `start_project` is passed, and the branch doesn't exist,
+ # it would try to find the commits from it instead of current repository.
def with_branch(
branch_name,
- base_branch_name: nil,
- base_project: repository.project,
+ start_branch_name: nil,
+ start_project: repository.project,
&block)
check_with_branch_arguments!(
- branch_name, base_branch_name, base_project)
+ branch_name, start_branch_name, start_project)
update_branch_with_hooks(branch_name) do
repository.with_repo_branch_commit(
- base_project.repository,
- base_branch_name || branch_name,
+ start_project.repository,
+ start_branch_name || branch_name,
&block)
end
end
@@ -148,27 +148,27 @@ class GitOperationService
end
def check_with_branch_arguments!(
- branch_name, base_branch_name, base_project)
+ branch_name, start_branch_name, start_project)
return if repository.branch_exists?(branch_name)
- if repository.project != base_project
- unless base_branch_name
+ if repository.project != start_project
+ unless start_branch_name
raise ArgumentError,
- 'Should also pass :base_branch_name if' +
- ' :base_project is different from current project'
+ 'Should also pass :start_branch_name if' +
+ ' :start_project is different from current project'
end
- unless base_project.repository.branch_exists?(base_branch_name)
+ unless start_project.repository.branch_exists?(start_branch_name)
raise ArgumentError,
"Cannot find branch #{branch_name} nor" \
- " #{base_branch_name} from" \
- " #{base_project.path_with_namespace}"
+ " #{start_branch_name} from" \
+ " #{start_project.path_with_namespace}"
end
- elsif base_branch_name
- unless repository.branch_exists?(base_branch_name)
+ elsif start_branch_name
+ unless repository.branch_exists?(start_branch_name)
raise ArgumentError,
"Cannot find branch #{branch_name} nor" \
- " #{base_branch_name} from" \
+ " #{start_branch_name} from" \
" #{repository.project.path_with_namespace}"
end
end