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/models/repository.rb | |
parent | 593228ffe3b2e4ff82c4d63e5d5c59b835f70085 (diff) |
Rename source to base to avoid confusion from MR
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index e834936aa93..a335c629a78 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -748,12 +748,12 @@ class Repository user, path, message:, branch_name:, author_email: nil, author_name: nil, - source_branch_name: nil, source_project: project) + base_branch_name: nil, base_project: project) check_tree_entry_for_dir(branch_name, path) - if source_branch_name - source_project.repository. - check_tree_entry_for_dir(source_branch_name, path) + if base_branch_name + base_project.repository. + check_tree_entry_for_dir(base_branch_name, path) end commit_file( @@ -765,8 +765,8 @@ class Repository update: false, author_email: author_email, author_name: author_name, - source_branch_name: source_branch_name, - source_project: source_project) + base_branch_name: base_branch_name, + base_project: base_project) end # rubocop:enable Metrics/ParameterLists @@ -775,7 +775,7 @@ class Repository user, path, content, message:, branch_name:, update: true, author_email: nil, author_name: nil, - source_branch_name: nil, source_project: project) + base_branch_name: nil, base_project: project) unless update error_message = "Filename already exists; update not allowed" @@ -783,8 +783,8 @@ class Repository raise Gitlab::Git::Repository::InvalidBlobName.new(error_message) end - if source_branch_name && - source_project.repository.tree_entry_at(source_branch_name, path) + if base_branch_name && + base_project.repository.tree_entry_at(base_branch_name, path) raise Gitlab::Git::Repository::InvalidBlobName.new(error_message) end end @@ -795,8 +795,8 @@ class Repository branch_name: branch_name, author_email: author_email, author_name: author_name, - source_branch_name: source_branch_name, - source_project: source_project, + base_branch_name: base_branch_name, + base_project: base_project, actions: [{ action: :create, file_path: path, content: content }]) @@ -808,7 +808,7 @@ class Repository user, path, content, message:, branch_name:, previous_path:, author_email: nil, author_name: nil, - source_branch_name: nil, source_project: project) + base_branch_name: nil, base_project: project) action = if previous_path && previous_path != path :move else @@ -821,8 +821,8 @@ class Repository branch_name: branch_name, author_email: author_email, author_name: author_name, - source_branch_name: source_branch_name, - source_project: source_project, + base_branch_name: base_branch_name, + base_project: base_project, actions: [{ action: action, file_path: path, content: content, @@ -835,15 +835,15 @@ class Repository user, path, message:, branch_name:, author_email: nil, author_name: nil, - source_branch_name: nil, source_project: project) + base_branch_name: nil, base_project: project) multi_action( user: user, message: message, branch_name: branch_name, author_email: author_email, author_name: author_name, - source_branch_name: source_branch_name, - source_project: source_project, + base_branch_name: base_branch_name, + base_project: base_project, actions: [{ action: :delete, file_path: path }]) end @@ -853,16 +853,16 @@ class Repository def multi_action( user:, branch_name:, message:, actions:, author_email: nil, author_name: nil, - source_branch_name: nil, source_project: project) + base_branch_name: nil, base_project: project) GitOperationService.new(user, self).with_branch( branch_name, - source_branch_name: source_branch_name, - source_project: source_project) do |source_commit| + base_branch_name: base_branch_name, + base_project: base_project) do |base_commit| index = rugged.index - parents = if source_commit - index.read_tree(source_commit.raw_commit.tree) - [source_commit.sha] + parents = if base_commit + index.read_tree(base_commit.raw_commit.tree) + [base_commit.sha] else [] end @@ -910,8 +910,8 @@ class Repository def merge(user, merge_request, options = {}) GitOperationService.new(user, self).with_branch( - merge_request.target_branch) do |source_commit| - our_commit = source_commit.sha + merge_request.target_branch) do |base_commit| + our_commit = base_commit.sha their_commit = merge_request.diff_head_sha raise 'Invalid merge target' unless our_commit @@ -935,15 +935,15 @@ class Repository def revert( user, commit, branch_name, revert_tree_id = nil, - source_branch_name: nil, source_project: project) + base_branch_name: nil, base_project: project) revert_tree_id ||= check_revert_content(commit, branch_name) return false unless revert_tree_id GitOperationService.new(user, self).with_branch( branch_name, - source_branch_name: source_branch_name, - source_project: source_project) do |source_commit| + base_branch_name: base_branch_name, + base_project: base_project) do |base_commit| committer = user_to_committer(user) @@ -952,21 +952,21 @@ class Repository author: committer, committer: committer, tree: revert_tree_id, - parents: [source_commit.sha]) + parents: [base_commit.sha]) end end def cherry_pick( user, commit, branch_name, cherry_pick_tree_id = nil, - source_branch_name: nil, source_project: project) + base_branch_name: nil, base_project: project) cherry_pick_tree_id ||= check_cherry_pick_content(commit, branch_name) return false unless cherry_pick_tree_id GitOperationService.new(user, self).with_branch( branch_name, - source_branch_name: source_branch_name, - source_project: source_project) do |source_commit| + base_branch_name: base_branch_name, + base_project: base_project) do |base_commit| committer = user_to_committer(user) @@ -979,7 +979,7 @@ class Repository }, committer: committer, tree: cherry_pick_tree_id, - parents: [source_commit.sha]) + parents: [base_commit.sha]) end end @@ -1066,20 +1066,20 @@ class Repository Gitlab::Popen.popen(args, path_to_repo).first.lines.map(&:strip) end - def with_repo_branch_commit(source_repository, source_branch_name) + def with_repo_branch_commit(base_repository, base_branch_name) branch_name_or_sha = - if source_repository == self - source_branch_name + if base_repository == self + base_branch_name else tmp_ref = "refs/tmp/#{SecureRandom.hex}/head" fetch_ref( - source_repository.path_to_repo, - "#{Gitlab::Git::BRANCH_REF_PREFIX}#{source_branch_name}", + base_repository.path_to_repo, + "#{Gitlab::Git::BRANCH_REF_PREFIX}#{base_branch_name}", tmp_ref ) - source_repository.commit(source_branch_name).sha + base_repository.commit(base_branch_name).sha end yield(commit(branch_name_or_sha)) |