Read about our upcoming Code of Conduct on this issue

Commit abb87832 authored by Gabriel Mazetto's avatar Gabriel Mazetto
Browse files

Rename many path_with_namespace -> full_path

parent 98efcda80168
...@@ -40,7 +40,7 @@ def ci_build_details_path(merge_request) ...@@ -40,7 +40,7 @@ def ci_build_details_path(merge_request)
def merge_path_description(merge_request, separator) def merge_path_description(merge_request, separator)
if merge_request.for_fork? if merge_request.for_fork?
"Project:Branches: #{@merge_request.source_project_path}:#{@merge_request.source_branch} #{separator} #{@merge_request.target_project.path_with_namespace}:#{@merge_request.target_branch}" "Project:Branches: #{@merge_request.source_project_path}:#{@merge_request.source_branch} #{separator} #{@merge_request.target_project.full_path}:#{@merge_request.target_branch}"
else else
"Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}" "Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}"
end end
......
...@@ -398,7 +398,7 @@ def koding_project_url(project = nil, branch = nil, sha = nil) ...@@ -398,7 +398,7 @@ def koding_project_url(project = nil, branch = nil, sha = nil)
if project if project
import_path = "/Home/Stacks/import" import_path = "/Home/Stacks/import"
repo = project.path_with_namespace repo = project.full_path
branch ||= project.default_branch branch ||= project.default_branch
sha ||= project.commit.short_id sha ||= project.commit.short_id
...@@ -458,7 +458,7 @@ def project_status_css_class(status) ...@@ -458,7 +458,7 @@ def project_status_css_class(status)
def readme_cache_key def readme_cache_key
sha = @project.commit.try(:sha) || 'nil' sha = @project.commit.try(:sha) || 'nil'
[@project.path_with_namespace, sha, "readme"].join('-') [@project.full_path, sha, "readme"].join('-')
end end
def current_ref def current_ref
......
...@@ -165,7 +165,7 @@ def add_project_headers ...@@ -165,7 +165,7 @@ def add_project_headers
headers['X-GitLab-Project'] = @project.name headers['X-GitLab-Project'] = @project.name
headers['X-GitLab-Project-Id'] = @project.id headers['X-GitLab-Project-Id'] = @project.id
headers['X-GitLab-Project-Path'] = @project.path_with_namespace headers['X-GitLab-Project-Path'] = @project.full_path
end end
def add_unsubscription_headers_and_links def add_unsubscription_headers_and_links
......
...@@ -317,7 +317,7 @@ def config_processor ...@@ -317,7 +317,7 @@ def config_processor
return @config_processor if defined?(@config_processor) return @config_processor if defined?(@config_processor)
@config_processor ||= begin @config_processor ||= begin
Ci::GitlabCiYamlProcessor.new(ci_yaml_file, project.path_with_namespace) Ci::GitlabCiYamlProcessor.new(ci_yaml_file, project.full_path)
rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e
self.yaml_errors = e.message self.yaml_errors = e.message
nil nil
......
...@@ -630,7 +630,7 @@ def issues_mentioned_but_not_closing(current_user) ...@@ -630,7 +630,7 @@ def issues_mentioned_but_not_closing(current_user)
def target_project_path def target_project_path
if target_project if target_project
target_project.path_with_namespace target_project.full_path
else else
"(removed)" "(removed)"
end end
...@@ -638,7 +638,7 @@ def target_project_path ...@@ -638,7 +638,7 @@ def target_project_path
def source_project_path def source_project_path
if source_project if source_project
source_project.path_with_namespace source_project.full_path
else else
"(removed)" "(removed)"
end end
......
...@@ -379,7 +379,7 @@ def self.with_feature_available_for_user(feature, user) ...@@ -379,7 +379,7 @@ def self.with_feature_available_for_user(feature, user)
begin begin
Projects::HousekeepingService.new(project).execute Projects::HousekeepingService.new(project).execute
rescue Projects::HousekeepingService::LeaseTaken => e rescue Projects::HousekeepingService::LeaseTaken => e
Rails.logger.info("Could not perform housekeeping for project #{project.path_with_namespace} (#{project.id}): #{e}") Rails.logger.info("Could not perform housekeeping for project #{project.full_path} (#{project.id}): #{e}")
end end
end end
end end
...@@ -485,7 +485,7 @@ def repository ...@@ -485,7 +485,7 @@ def repository
def container_registry_url def container_registry_url
if Gitlab.config.registry.enabled if Gitlab.config.registry.enabled
"#{Gitlab.config.registry.host_port}/#{path_with_namespace.downcase}" "#{Gitlab.config.registry.host_port}/#{full_path.downcase}"
end end
end end
...@@ -524,16 +524,16 @@ def add_import_job ...@@ -524,16 +524,16 @@ def add_import_job
job_id = job_id =
if forked? if forked?
RepositoryForkWorker.perform_async(id, forked_from_project.repository_storage_path, RepositoryForkWorker.perform_async(id, forked_from_project.repository_storage_path,
forked_from_project.path_with_namespace, forked_from_project.full_path,
self.namespace.full_path) self.namespace.full_path)
else else
RepositoryImportWorker.perform_async(self.id) RepositoryImportWorker.perform_async(self.id)
end end
if job_id if job_id
Rails.logger.info "Import job started for #{path_with_namespace} with job ID #{job_id}" Rails.logger.info "Import job started for #{full_path} with job ID #{job_id}"
else else
Rails.logger.error "Import job failed to start for #{path_with_namespace}" Rails.logger.error "Import job failed to start for #{full_path}"
end end
end end
...@@ -694,7 +694,7 @@ def to_param ...@@ -694,7 +694,7 @@ def to_param
# `from` argument can be a Namespace or Project. # `from` argument can be a Namespace or Project.
def to_reference(from = nil, full: false) def to_reference(from = nil, full: false)
if full || cross_namespace_reference?(from) if full || cross_namespace_reference?(from)
path_with_namespace full_path
elsif cross_project_reference?(from) elsif cross_project_reference?(from)
path path
end end
...@@ -718,7 +718,7 @@ def new_issue_address(author) ...@@ -718,7 +718,7 @@ def new_issue_address(author)
author.ensure_incoming_email_token! author.ensure_incoming_email_token!
Gitlab::IncomingEmail.reply_address( Gitlab::IncomingEmail.reply_address(
"#{path_with_namespace}+#{author.incoming_email_token}") "#{full_path}+#{author.incoming_email_token}")
end end
def build_commit_note(commit) def build_commit_note(commit)
...@@ -1002,7 +1002,7 @@ def hook_attrs(backward: true) ...@@ -1002,7 +1002,7 @@ def hook_attrs(backward: true)
git_http_url: http_url_to_repo, git_http_url: http_url_to_repo,
namespace: namespace.name, namespace: namespace.name,
visibility_level: visibility_level, visibility_level: visibility_level,
path_with_namespace: path_with_namespace, path_with_namespace: full_path,
default_branch: default_branch, default_branch: default_branch,
ci_config_path: ci_config_path ci_config_path: ci_config_path
} }
...@@ -1272,8 +1272,8 @@ def predefined_variables ...@@ -1272,8 +1272,8 @@ def predefined_variables
[ [
{ key: 'CI_PROJECT_ID', value: id.to_s, public: true }, { key: 'CI_PROJECT_ID', value: id.to_s, public: true },
{ key: 'CI_PROJECT_NAME', value: path, public: true }, { key: 'CI_PROJECT_NAME', value: path, public: true },
{ key: 'CI_PROJECT_PATH', value: path_with_namespace, public: true }, { key: 'CI_PROJECT_PATH', value: full_path, public: true },
{ key: 'CI_PROJECT_PATH_SLUG', value: path_with_namespace.parameterize, public: true }, { key: 'CI_PROJECT_PATH_SLUG', value: full_path.parameterize, public: true },
{ key: 'CI_PROJECT_NAMESPACE', value: namespace.full_path, public: true }, { key: 'CI_PROJECT_NAMESPACE', value: namespace.full_path, public: true },
{ key: 'CI_PROJECT_URL', value: web_url, public: true } { key: 'CI_PROJECT_URL', value: web_url, public: true }
] ]
...@@ -1378,6 +1378,7 @@ def default_merge_request_target ...@@ -1378,6 +1378,7 @@ def default_merge_request_target
alias_method :name_with_namespace, :full_name alias_method :name_with_namespace, :full_name
alias_method :human_name, :full_name alias_method :human_name, :full_name
# @deprecated cannot remove yet because it has an index with its name in elasticsearch
alias_method :path_with_namespace, :full_path alias_method :path_with_namespace, :full_path
private private
...@@ -1432,7 +1433,7 @@ def check_pending_delete ...@@ -1432,7 +1433,7 @@ def check_pending_delete
def pending_delete_twin def pending_delete_twin
return false unless path return false unless path
Project.pending_delete.find_by_full_path(path_with_namespace) Project.pending_delete.find_by_full_path(full_path)
end end
## ##
......
...@@ -35,9 +35,9 @@ def execute(data) ...@@ -35,9 +35,9 @@ def execute(data)
data[:after], data[:after],
token: token, token: token,
repo: project.repository.path_to_repo, repo: project.repository.path_to_repo,
repo_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}", repo_url: "#{Gitlab.config.gitlab.url}/#{project.full_path}",
commit_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/%s", commit_url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/commit/%s",
diff_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/compare/%s...%s" diff_url: "#{Gitlab.config.gitlab.url}/#{project.full_path}/compare/%s...%s"
) )
end end
end end
...@@ -140,7 +140,7 @@ def create_cross_reference_note(mentioned, noteable, author) ...@@ -140,7 +140,7 @@ def create_cross_reference_note(mentioned, noteable, author)
url: resource_url(user_path(author)) url: resource_url(user_path(author))
}, },
project: { project: {
name: project.path_with_namespace, name: project.full_path,
url: resource_url(namespace_project_path(project.namespace, project)) # rubocop:disable Cop/ProjectPathHelper url: resource_url(namespace_project_path(project.namespace, project)) # rubocop:disable Cop/ProjectPathHelper
}, },
entity: { entity: {
......
...@@ -27,7 +27,7 @@ def path ...@@ -27,7 +27,7 @@ def path
end end
def path_with_namespace def path_with_namespace
@project.path_with_namespace + ".wiki" @project.full_path + '.wiki'
end end
def web_url def web_url
...@@ -47,7 +47,7 @@ def http_url_to_repo ...@@ -47,7 +47,7 @@ def http_url_to_repo
end end
def wiki_base_path def wiki_base_path
[Gitlab.config.gitlab.relative_url_root, "/", @project.path_with_namespace, "/wikis"].join('') [Gitlab.config.gitlab.relative_url_root, "/", @project.full_path, "/wikis"].join('')
end end
# Returns the Gollum::Wiki object. # Returns the Gollum::Wiki object.
......
...@@ -60,7 +60,7 @@ def with_branch( ...@@ -60,7 +60,7 @@ def with_branch(
start_branch_name = nil if start_repository.empty_repo? start_branch_name = nil if start_repository.empty_repo?
if start_branch_name && !start_repository.branch_exists?(start_branch_name) if start_branch_name && !start_repository.branch_exists?(start_branch_name)
raise ArgumentError, "Cannot find branch #{start_branch_name} in #{start_repository.path_with_namespace}" raise ArgumentError, "Cannot find branch #{start_branch_name} in #{start_repository.full_path}"
end end
update_branch_with_hooks(branch_name) do update_branch_with_hooks(branch_name) do
......
...@@ -9,7 +9,7 @@ class DestroyService < BaseService ...@@ -9,7 +9,7 @@ class DestroyService < BaseService
def async_execute def async_execute
project.update_attribute(:pending_delete, true) project.update_attribute(:pending_delete, true)
job_id = ProjectDestroyWorker.perform_async(project.id, current_user.id, params) job_id = ProjectDestroyWorker.perform_async(project.id, current_user.id, params)
Rails.logger.info("User #{current_user.id} scheduled destruction of project #{project.path_with_namespace} with job ID #{job_id}") Rails.logger.info("User #{current_user.id} scheduled destruction of project #{project.full_path} with job ID #{job_id}")
end end
def execute def execute
......
...@@ -11,7 +11,7 @@ def execute ...@@ -11,7 +11,7 @@ def execute
success success
rescue => e rescue => e
error("Error importing repository #{project.import_url} into #{project.path_with_namespace} - #{e.message}") error("Error importing repository #{project.import_url} into #{project.full_path} - #{e.message}")
end end
private private
......
...@@ -34,7 +34,7 @@ def execute(new_namespace) ...@@ -34,7 +34,7 @@ def execute(new_namespace)
private private
def transfer(project) def transfer(project)
@old_path = project.path_with_namespace @old_path = project.full_path
@old_group = project.group @old_group = project.group
@new_path = File.join(@new_namespace.try(:full_path) || '', project.path) @new_path = File.join(@new_namespace.try(:full_path) || '', project.path)
@old_namespace = project.namespace @old_namespace = project.namespace
......
...@@ -24,7 +24,7 @@ def build_event_data(model, event) ...@@ -24,7 +24,7 @@ def build_event_data(model, event)
key: model.key, key: model.key,
id: model.id id: model.id
) )
if model.user if model.user
data[:username] = model.user.username data[:username] = model.user.username
end end
...@@ -56,7 +56,7 @@ def build_event_data(model, event) ...@@ -56,7 +56,7 @@ def build_event_data(model, event)
when GroupMember when GroupMember
data.merge!(group_member_data(model)) data.merge!(group_member_data(model))
end end
data data
end end
...@@ -79,7 +79,7 @@ def project_data(model) ...@@ -79,7 +79,7 @@ def project_data(model)
{ {
name: model.name, name: model.name,
path: model.path, path: model.path,
path_with_namespace: model.path_with_namespace, path_with_namespace: model.full_path,
project_id: model.id, project_id: model.id,
owner_name: owner.name, owner_name: owner.name,
owner_email: owner.respond_to?(:email) ? owner.email : "", owner_email: owner.respond_to?(:email) ? owner.email : "",
...@@ -93,7 +93,7 @@ def project_member_data(model) ...@@ -93,7 +93,7 @@ def project_member_data(model)
{ {
project_name: project.name, project_name: project.name,
project_path: project.path, project_path: project.path,
project_path_with_namespace: project.path_with_namespace, project_path_with_namespace: project.full_path,
project_id: project.id, project_id: project.id,
user_username: model.user.username, user_username: model.user.username,
user_name: model.user.name, user_name: model.user.name,
......
...@@ -66,7 +66,7 @@ def send_branch_updates(push_data, project, repo_name, committer, branch) ...@@ -66,7 +66,7 @@ def send_branch_updates(push_data, project, repo_name, committer, branch)
end end
def send_new_branch(project, repo_name, committer, branch) def send_new_branch(project, repo_name, committer, branch)
repo_path = project.path_with_namespace repo_path = project.full_path
newbranch = "#{Gitlab.config.gitlab.url}/#{repo_path}/branches" newbranch = "#{Gitlab.config.gitlab.url}/#{repo_path}/branches"
newbranch = "\x0302\x1f#{newbranch}\x0f" if @colors newbranch = "\x0302\x1f#{newbranch}\x0f" if @colors
...@@ -109,7 +109,7 @@ def before_on_new_branch(push_data, project) ...@@ -109,7 +109,7 @@ def before_on_new_branch(push_data, project)
end end
def send_commits_count(data, project, repo, committer, branch) def send_commits_count(data, project, repo, committer, branch)
url = compare_url data, project.path_with_namespace url = compare_url data, project.full_path
commits = colorize_commits data['total_commits_count'] commits = colorize_commits data['total_commits_count']
new_commits = 'new commit' new_commits = 'new commit'
......
...@@ -16,7 +16,7 @@ def perform(project_id) ...@@ -16,7 +16,7 @@ def perform(project_id)
Gitlab::Metrics.add_event(:import_repository, Gitlab::Metrics.add_event(:import_repository,
import_url: @project.import_url, import_url: @project.import_url,
path: @project.path_with_namespace) path: @project.full_path)
project.update_columns(import_jid: self.jid, import_error: nil) project.update_columns(import_jid: self.jid, import_error: nil)
......
...@@ -16,6 +16,7 @@ def repository_storage_path ...@@ -16,6 +16,7 @@ def repository_storage_path
end end
def repository_path def repository_path
# TODO: review if the change from Legacy storage needs to reflect here as well.
File.join(repository_storage_path, read_attribute(:path_with_namespace) + '.git') File.join(repository_storage_path, read_attribute(:path_with_namespace) + '.git')
end end
......
...@@ -30,8 +30,8 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -30,8 +30,8 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
expect(@merge_request.source_project).to eq @forked_project expect(@merge_request.source_project).to eq @forked_project
expect(@merge_request.source_branch).to eq "fix" expect(@merge_request.source_branch).to eq "fix"
expect(@merge_request.target_branch).to eq "master" expect(@merge_request.target_branch).to eq "master"
expect(page).to have_content @forked_project.path_with_namespace expect(page).to have_content @forked_project.full_path
expect(page).to have_content @project.path_with_namespace expect(page).to have_content @project.full_path
expect(page).to have_content @merge_request.source_branch expect(page).to have_content @merge_request.source_branch
expect(page).to have_content @merge_request.target_branch expect(page).to have_content @merge_request.target_branch
...@@ -43,10 +43,10 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -43,10 +43,10 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
expect(page).to have_content('Target branch') expect(page).to have_content('Target branch')
first('.js-source-project').click first('.js-source-project').click
first('.dropdown-source-project a', text: @forked_project.path_with_namespace) first('.dropdown-source-project a', text: @forked_project.full_path)
first('.js-target-project').click first('.js-target-project').click
first('.dropdown-target-project a', text: @project.path_with_namespace) first('.dropdown-target-project a', text: @project.full_path)
first('.js-source-branch').click first('.js-source-branch').click
wait_for_requests wait_for_requests
...@@ -81,8 +81,8 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -81,8 +81,8 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
expect(@merge_request.source_project).to eq @forked_project expect(@merge_request.source_project).to eq @forked_project
expect(@merge_request.source_branch).to eq "fix" expect(@merge_request.source_branch).to eq "fix"
expect(@merge_request.target_branch).to eq "master" expect(@merge_request.target_branch).to eq "master"
expect(page).to have_content @forked_project.path_with_namespace expect(page).to have_content @forked_project.full_path
expect(page).to have_content @project.path_with_namespace expect(page).to have_content @project.full_path
expect(page).to have_content @merge_request.source_branch expect(page).to have_content @merge_request.source_branch
expect(page).to have_content @merge_request.target_branch expect(page).to have_content @merge_request.target_branch
end end
......
...@@ -47,7 +47,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps ...@@ -47,7 +47,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step 'I should be redirected to "Community" page' do step 'I should be redirected to "Community" page' do
project = Project.find_by(name: 'Community') project = Project.find_by(name: 'Community')
expect(current_path).to eq "/#{project.path_with_namespace}" expect(current_path).to eq "/#{project.full_path}"
expect(status_code).to eq 200 expect(status_code).to eq 200
end end
...@@ -61,7 +61,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps ...@@ -61,7 +61,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step 'I should be redirected to "Enterprise" page' do step 'I should be redirected to "Enterprise" page' do
project = Project.find_by(name: 'Enterprise') project = Project.find_by(name: 'Enterprise')
expect(current_path).to eq "/#{project.path_with_namespace}" expect(current_path).to eq "/#{project.full_path}"
expect(status_code).to eq 200 expect(status_code).to eq 200
end end
end end
...@@ -142,7 +142,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps ...@@ -142,7 +142,7 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps
end end
step 'I should see non-escaped link in the pages list' do step 'I should see non-escaped link in the pages list' do
expect(page).to have_xpath("//a[@href='/#{project.path_with_namespace}/wikis/one/two/three-test']") expect(page).to have_xpath("//a[@href='/#{project.full_path}/wikis/one/two/three-test']")
end end
step 'I edit the Wiki page with a path' do step 'I edit the Wiki page with a path' do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment