Skip to content
Snippets Groups Projects
Commit 7f833087 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent bbe24306
No related branches found
No related tags found
No related merge requests found
Showing
with 110 additions and 126 deletions
Loading
Loading
@@ -163,7 +163,7 @@ export const createCommitPayload = ({
});
 
export const createNewMergeRequestUrl = (projectUrl, source, target) =>
`${projectUrl}/-/merge_requests/new?merge_request[source_branch]=${source}&merge_request[target_branch]=${target}&nav_source=webide`;
`${projectUrl}/merge_requests/new?merge_request[source_branch]=${source}&merge_request[target_branch]=${target}&nav_source=webide`;
 
const sortTreesByTypeAndName = (a, b) => {
if (a.type === 'tree' && b.type === 'blob') {
Loading
Loading
Loading
Loading
@@ -32,17 +32,17 @@ import { __ } from './locale';
//
// <ul class="nav-links merge-request-tabs">
// <li class="notes-tab active">
// <a data-action="notes" data-target="#notes" data-toggle="tab" href="/foo/bar/-/merge_requests/1">
// <a data-action="notes" data-target="#notes" data-toggle="tab" href="/foo/bar/merge_requests/1">
// Discussion
// </a>
// </li>
// <li class="commits-tab">
// <a data-action="commits" data-target="#commits" data-toggle="tab" href="/foo/bar/-/merge_requests/1/commits">
// <a data-action="commits" data-target="#commits" data-toggle="tab" href="/foo/bar/merge_requests/1/commits">
// Commits
// </a>
// </li>
// <li class="diffs-tab">
// <a data-action="diffs" data-target="#diffs" data-toggle="tab" href="/foo/bar/-/merge_requests/1/diffs">
// <a data-action="diffs" data-target="#diffs" data-toggle="tab" href="/foo/bar/merge_requests/1/diffs">
// Diffs
// </a>
// </li>
Loading
Loading
@@ -260,17 +260,17 @@ export default class MergeRequestTabs {
//
// Examples:
//
// location.pathname # => "/namespace/project/-/merge_requests/1"
// location.pathname # => "/namespace/project/merge_requests/1"
// setCurrentAction('diffs')
// location.pathname # => "/namespace/project/-/merge_requests/1/diffs"
// location.pathname # => "/namespace/project/merge_requests/1/diffs"
//
// location.pathname # => "/namespace/project/-/merge_requests/1/diffs"
// location.pathname # => "/namespace/project/merge_requests/1/diffs"
// setCurrentAction('show')
// location.pathname # => "/namespace/project/-/merge_requests/1"
// location.pathname # => "/namespace/project/merge_requests/1"
//
// location.pathname # => "/namespace/project/-/merge_requests/1/diffs"
// location.pathname # => "/namespace/project/merge_requests/1/diffs"
// setCurrentAction('commits')
// location.pathname # => "/namespace/project/-/merge_requests/1/commits"
// location.pathname # => "/namespace/project/merge_requests/1/commits"
//
// Returns the new URL String
setCurrentAction(action) {
Loading
Loading
Loading
Loading
@@ -104,10 +104,10 @@ export default {
return acc.concat({
name,
path,
to: `/-/tree/${this.ref}${path}`,
to: `/tree/${this.ref}${path}`,
});
},
[{ name: this.projectShortPath, path: '/', to: `/-/tree/${this.ref}/` }],
[{ name: this.projectShortPath, path: '/', to: `/tree/${this.ref}/` }],
);
},
canCreateMrFromFork() {
Loading
Loading
Loading
Loading
@@ -15,7 +15,7 @@ export default {
const splitArray = this.path.split('/');
splitArray.pop();
 
return { path: `/-/tree/${this.commitRef}/${splitArray.join('/')}` };
return { path: `/tree/${this.commitRef}/${splitArray.join('/')}` };
},
},
methods: {
Loading
Loading
Loading
Loading
@@ -84,7 +84,7 @@ export default {
},
computed: {
routerLinkTo() {
return this.isFolder ? { path: `/-/tree/${this.ref}/${this.path}` } : null;
return this.isFolder ? { path: `/tree/${this.ref}/${this.path}` } : null;
},
iconName() {
return `fa-${getIconName(this.type, this.path)}`;
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ export default function createRouter(base, baseRef) {
base: joinPaths(gon.relative_url_root || '', base),
routes: [
{
path: `/-/tree/${baseRef}(/.*)?`,
path: `/tree/${baseRef}(/.*)?`,
name: 'treePath',
component: TreePage,
props: route => ({
Loading
Loading
Loading
Loading
@@ -79,10 +79,10 @@ export default {
return this.projectPath.indexOf('/') === 0 ? '' : `${gon.relative_url_root}/`;
},
fullOldPath() {
return `${this.basePath}${this.projectPath}/-/raw/${this.oldSha}/${this.oldPath}`;
return `${this.basePath}${this.projectPath}/raw/${this.oldSha}/${this.oldPath}`;
},
fullNewPath() {
return `${this.basePath}${this.projectPath}/-/raw/${this.newSha}/${this.newPath}`;
return `${this.basePath}${this.projectPath}/raw/${this.newSha}/${this.newPath}`;
},
},
};
Loading
Loading
Loading
Loading
@@ -43,8 +43,6 @@ module SubmoduleHelper
elsif github_dot_com_url?(url)
standard_links('github.com', namespace, project, submodule_item_id)
elsif gitlab_dot_com_url?(url)
# This need to be replaced with /-/tree routing once one is landed on
# GitLab.com. Issue https://gitlab.com/gitlab-org/gitlab/issues/42764
standard_links('gitlab.com', namespace, project, submodule_item_id)
else
[sanitize_submodule_url(url), nil]
Loading
Loading
Loading
Loading
@@ -38,13 +38,13 @@ module TreeHelper
# many paths, as with a repository tree that has thousands of items.
def fast_project_blob_path(project, blob_path)
ActionDispatch::Journey::Router::Utils.escape_path(
File.join(relative_url_root, project.path_with_namespace, '-', 'blob', blob_path)
File.join(relative_url_root, project.path_with_namespace, 'blob', blob_path)
)
end
 
def fast_project_tree_path(project, tree_path)
ActionDispatch::Journey::Router::Utils.escape_path(
File.join(relative_url_root, project.path_with_namespace, '-', 'tree', tree_path)
File.join(relative_url_root, project.path_with_namespace, 'tree', tree_path)
)
end
 
Loading
Loading
Loading
Loading
@@ -62,7 +62,7 @@ module ChatMessage
end
 
def merge_request_url
"#{project_url}/-/merge_requests/#{merge_request_iid}"
"#{project_url}/merge_requests/#{merge_request_iid}"
end
 
# overridden in EE
Loading
Loading
Loading
Loading
@@ -184,7 +184,7 @@ class HipchatService < Service
description = obj_attr[:description]
title = render_line(obj_attr[:title])
 
merge_request_url = "#{project_url}/-/merge_requests/#{merge_request_id}"
merge_request_url = "#{project_url}/merge_requests/#{merge_request_id}"
merge_request_link = "<a href=\"#{merge_request_url}\">merge request !#{merge_request_id}</a>"
message = ["#{user_name} #{state} #{merge_request_link} in " \
"#{project_link}: <b>#{title}</b>"]
Loading
Loading
---
title: Move merge request routes under /-/ scope
merge_request: 21126
author:
type: deprecated
---
title: Move repository routes under - scope
merge_request: 20455
author:
type: deprecated
Loading
Loading
@@ -271,82 +271,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
 
resources :merge_requests, concerns: :awardable, except: [:new, :create, :show], constraints: { id: /\d+/ } do
member do
get :show # Insert this first to ensure redirections using merge_requests#show match this route
get :commit_change_content
post :merge
post :cancel_auto_merge
get :pipeline_status
get :ci_environments_status
post :toggle_subscription
post :remove_wip
post :assign_related_issues
get :discussions, format: :json
post :rebase
get :test_reports
get :exposed_artifacts
scope constraints: ->(req) { req.format == :json }, as: :json do
get :commits
get :pipelines
get :diffs, to: 'merge_requests/diffs#show'
get :diffs_batch, to: 'merge_requests/diffs#diffs_batch'
get :diffs_metadata, to: 'merge_requests/diffs#diffs_metadata'
get :widget, to: 'merge_requests/content#widget'
get :cached_widget, to: 'merge_requests/content#cached_widget'
end
scope action: :show do
get :commits, defaults: { tab: 'commits' }
get :pipelines, defaults: { tab: 'pipelines' }
get :diffs, defaults: { tab: 'diffs' }
end
get :diff_for_path, controller: 'merge_requests/diffs'
scope controller: 'merge_requests/conflicts' do
get :conflicts, action: :show
get :conflict_for_path
post :resolve_conflicts
end
end
collection do
get :diff_for_path
post :bulk_update
end
resources :discussions, only: [:show], constraints: { id: /\h{40}/ } do
member do
post :resolve
delete :resolve, action: :unresolve
end
end
end
scope path: 'merge_requests', controller: 'merge_requests/creations' do
post '', action: :create, as: nil
scope path: 'new', as: :new_merge_request do
get '', action: :new
scope constraints: ->(req) { req.format == :json }, as: :json do
get :diffs
get :pipelines
end
scope action: :new do
get :diffs, defaults: { tab: 'diffs' }
get :pipelines, defaults: { tab: 'pipelines' }
end
get :diff_for_path
get :branch_from
get :branch_to
end
end
# The wiki routing contains wildcard characters so
# its preferable to keep it below all other project routes
draw :wiki
Loading
Loading
@@ -404,6 +328,82 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
 
resources :merge_requests, concerns: :awardable, except: [:new, :create, :show], constraints: { id: /\d+/ } do
member do
get :show # Insert this first to ensure redirections using merge_requests#show match this route
get :commit_change_content
post :merge
post :cancel_auto_merge
get :pipeline_status
get :ci_environments_status
post :toggle_subscription
post :remove_wip
post :assign_related_issues
get :discussions, format: :json
post :rebase
get :test_reports
get :exposed_artifacts
scope constraints: ->(req) { req.format == :json }, as: :json do
get :commits
get :pipelines
get :diffs, to: 'merge_requests/diffs#show'
get :diffs_batch, to: 'merge_requests/diffs#diffs_batch'
get :diffs_metadata, to: 'merge_requests/diffs#diffs_metadata'
get :widget, to: 'merge_requests/content#widget'
get :cached_widget, to: 'merge_requests/content#cached_widget'
end
scope action: :show do
get :commits, defaults: { tab: 'commits' }
get :pipelines, defaults: { tab: 'pipelines' }
get :diffs, defaults: { tab: 'diffs' }
end
get :diff_for_path, controller: 'merge_requests/diffs'
scope controller: 'merge_requests/conflicts' do
get :conflicts, action: :show
get :conflict_for_path
post :resolve_conflicts
end
end
collection do
get :diff_for_path
post :bulk_update
end
resources :discussions, only: [:show], constraints: { id: /\h{40}/ } do
member do
post :resolve
delete :resolve, action: :unresolve
end
end
end
scope path: 'merge_requests', controller: 'merge_requests/creations' do
post '', action: :create, as: nil
scope path: 'new', as: :new_merge_request do
get '', action: :new
scope constraints: ->(req) { req.format == :json }, as: :json do
get :diffs
get :pipelines
end
scope action: :new do
get :diffs, defaults: { tab: 'diffs' }
get :pipelines, defaults: { tab: 'pipelines' }
end
get :diff_for_path
get :branch_from
get :branch_to
end
end
resources :pipelines, only: [:index, :new, :create, :show] do
collection do
resource :pipelines_settings, path: 'settings', only: [:show, :update]
Loading
Loading
@@ -557,8 +557,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
:forks, :group_links, :import, :avatar, :mirror,
:cycle_analytics, :mattermost, :variables, :triggers,
:environments, :protected_environments, :error_tracking,
:serverless, :clusters, :audit_events, :wikis, :merge_requests,
:blob, :tree, :raw, :blame, :commits, :create_dir, :find_file, :files)
:serverless, :clusters, :audit_events, :wikis)
end
 
# rubocop: disable Cop/PutProjectRoutesUnderScope
Loading
Loading
Loading
Loading
@@ -65,7 +65,7 @@ scope format: false do
resources :protected_tags, only: [:index, :show, :create, :update, :destroy]
end
 
scope path: '-', constraints: { id: /[^\0]+/ } do
scope constraints: { id: /[^\0]+/ } do
scope controller: :blob do
get '/new/*id', action: :new, as: :new_blob
post '/create/*id', action: :create, as: :create_blob
Loading
Loading
Loading
Loading
@@ -152,18 +152,11 @@ module Banzai
 
def rebuild_relative_uri(uri)
file_path = nested_file_path_if_exists(uri)
resource_type = uri_type(file_path)
# Repository routes are under /-/ scope now.
# Since we craft a path without using route helpers we must
# ensure - is added here.
prefix = '-' if %w(tree blob raw commits).include?(resource_type.to_s)
 
uri.path = [
relative_url_root,
project.full_path,
prefix,
resource_type,
uri_type(file_path),
Addressable::URI.escape(ref).gsub('#', '%23'),
Addressable::URI.escape(file_path)
].compact.join('/').squeeze('/').chomp('/')
Loading
Loading
Loading
Loading
@@ -12,12 +12,10 @@ module Gitlab
def link_dependencies
link_json('ImportPath') do |path|
case path
when %r{\A(?<repo>github\.com/#{REPO_REGEX})/(?<path>.+)\z}
"https://#{$~[:repo]}/tree/master/#{$~[:path]}"
when %r{\A(?<repo>gitlab\.com/#{NESTED_REPO_REGEX})\.git/(?<path>.+)\z},
%r{\A(?<repo>gitlab\.com/#{REPO_REGEX})/(?<path>.+)\z}
%r{\A(?<repo>git(lab|hub)\.com/#{REPO_REGEX})/(?<path>.+)\z}
 
"https://#{$~[:repo]}/-/tree/master/#{$~[:path]}"
"https://#{$~[:repo]}/tree/master/#{$~[:path]}"
when /\Agolang\.org/
"https://godoc.org/#{path}"
else
Loading
Loading
Loading
Loading
@@ -60,7 +60,7 @@ module Gitlab
end
 
meta_import_tag = tag :meta, name: 'go-import', content: "#{import_prefix} git #{repository_url}"
meta_source_tag = tag :meta, name: 'go-source', content: "#{import_prefix} #{project_url} #{project_url}/-/tree/#{branch}{/dir} #{project_url}/-/blob/#{branch}{/dir}/{file}#L{line}"
meta_source_tag = tag :meta, name: 'go-source', content: "#{import_prefix} #{project_url} #{project_url}/tree/#{branch}{/dir} #{project_url}/blob/#{branch}{/dir}/{file}#L{line}"
head_tag = content_tag :head, meta_import_tag + meta_source_tag
html_tag = content_tag :html, head_tag + body_tag
[html_tag, 200]
Loading
Loading
Loading
Loading
@@ -13328,6 +13328,9 @@ msgstr ""
msgid "ProductivityAanalytics|Merge requests"
msgstr ""
 
msgid "ProductivityAanalytics|is earlier than the allowed minimum date"
msgstr ""
msgid "ProductivityAnalytics|Ascending"
msgstr ""
 
Loading
Loading
@@ -13361,6 +13364,9 @@ msgstr ""
msgid "ProductivityAnalytics|Trendline"
msgstr ""
 
msgid "ProductivityAnalytics|is earlier than the given merged at after date"
msgstr ""
msgid "Profile"
msgstr ""
 
Loading
Loading
Loading
Loading
@@ -72,7 +72,7 @@ describe MetricsDashboard do
 
it 'includes project_blob_path only for project dashboards' do
expect(system_dashboard['project_blob_path']).to be_nil
expect(project_dashboard['project_blob_path']).to eq("/#{project.namespace.path}/#{project.name}/-/blob/master/.gitlab/dashboards/test.yml")
expect(project_dashboard['project_blob_path']).to eq("/#{project.namespace.path}/#{project.name}/blob/master/.gitlab/dashboards/test.yml")
end
 
describe 'project permissions' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment