Commit 0b4b12ff authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-02-09

# Conflicts:
#	spec/models/namespace_spec.rb

[ci skip]
parents d3564045 c5ad5a08
...@@ -2,11 +2,18 @@ export default class CILintEditor { ...@@ -2,11 +2,18 @@ export default class CILintEditor {
constructor() { constructor() {
this.editor = window.ace.edit('ci-editor'); this.editor = window.ace.edit('ci-editor');
this.textarea = document.querySelector('#content'); this.textarea = document.querySelector('#content');
this.clearYml = document.querySelector('.clear-yml');
this.editor.getSession().setMode('ace/mode/yaml'); this.editor.getSession().setMode('ace/mode/yaml');
this.editor.on('input', () => { this.editor.on('input', () => {
const content = this.editor.getSession().getValue(); const content = this.editor.getSession().getValue();
this.textarea.value = content; this.textarea.value = content;
}); });
this.clearYml.addEventListener('click', this.clear.bind(this));
}
clear() {
this.editor.setValue('');
} }
} }
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
.col-sm-12 .col-sm-12
.pull-left.prepend-top-10 .pull-left.prepend-top-10
= submit_tag('Validate', class: 'btn btn-success submit-yml') = submit_tag('Validate', class: 'btn btn-success submit-yml')
.pull-right.prepend-top-10
= button_tag('Clear', type: 'button', class: 'btn btn-default clear-yml')
.row.prepend-top-20 .row.prepend-top-20
.col-sm-12 .col-sm-12
......
---
title: Added clear button to ci lint editor
merge_request:
author: Michael Robinson
...@@ -64,9 +64,7 @@ You can also [search and filter](../../search/index.md#issues-and-merge-requests ...@@ -64,9 +64,7 @@ You can also [search and filter](../../search/index.md#issues-and-merge-requests
### Issues per group ### Issues per group
View all the issues in a group (that is, all the issues across all projects in that View issues in all projects in the group, including all projects of all descendant subgroups of the group. Navigate to **Group > Issues** to view these issues. This view also has the open and closed issues tabs.
group) by navigating to **Group > Issues**. This view also has the open and closed
issue tabs.
![Group Issues list view](img/group_issues_list_view.png) ![Group Issues list view](img/group_issues_list_view.png)
......
...@@ -71,9 +71,9 @@ and you can use the tabs available to quickly filter by open and closed. You can ...@@ -71,9 +71,9 @@ and you can use the tabs available to quickly filter by open and closed. You can
## Merge requests per group ## Merge requests per group
View all the merge requests in a group (that is, all the merge requests across all projects in that View merge requests in all projects in the group, including all projects of all descendant subgroups of the group. Navigate to **Group > Merge Requests** to view these merge requests. This view also has the open and closed merge requests tabs.
group) by navigating to **Group > Merge Requests**. This view also has the open, merged, and closed
merge request tabs, from which you can [search and filter the results](../../search/index.md#issues-and-merge-requests-per-group). You can [search and filter the results](../../search/index.md#issues-and-merge-requests-per-group) from here.
![Group Issues list view](img/group_merge_requests_list_view.png) ![Group Issues list view](img/group_merge_requests_list_view.png)
...@@ -154,6 +154,19 @@ administrator to do so. ...@@ -154,6 +154,19 @@ administrator to do so.
![Create new merge requests by email](img/create_from_email.png) ![Create new merge requests by email](img/create_from_email.png)
## Find the merge request that introduced a change
> **Note**: this feature was [implemented in GitLab 10.5](https://gitlab.com/gitlab-org/gitlab-ce/issues/2383).
When viewing the commit details page, GitLab will link to the merge request (or
merge requests, if it's in more than one) containing that commit.
This only applies to commits that are in the most recent version of a merge
request - if a commit was in a merge request, then rebased out of that merge
request, they will not be linked.
[Read more about merge request versions](versions.md)
## Revert changes ## Revert changes
GitLab implements Git's powerful feature to revert any commit with introducing GitLab implements Git's powerful feature to revert any commit with introducing
...@@ -168,7 +181,7 @@ of merge request diff is created. When you visit a merge request that contains ...@@ -168,7 +181,7 @@ of merge request diff is created. When you visit a merge request that contains
more than one pushes, you can select and compare the versions of those merge more than one pushes, you can select and compare the versions of those merge
request diffs. request diffs.
[Read more about the merge requests versions.](versions.md) [Read more about merge request versions](versions.md)
## Work In Progress merge requests ## Work In Progress merge requests
......
...@@ -1614,9 +1614,7 @@ module Gitlab ...@@ -1614,9 +1614,7 @@ module Gitlab
# Gitaly note: JV: Trying to get rid of the 'filter' option so we can implement this with 'git'. # Gitaly note: JV: Trying to get rid of the 'filter' option so we can implement this with 'git'.
def branches_filter(filter: nil, sort_by: nil) def branches_filter(filter: nil, sort_by: nil)
# n+1: https://gitlab.com/gitlab-org/gitlab-ce/issues/37464 branches = rugged.branches.each(filter).map do |rugged_ref|
branches = Gitlab::GitalyClient.allow_n_plus_1_calls do
rugged.branches.each(filter).map do |rugged_ref|
begin begin
target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target) target_commit = Gitlab::Git::Commit.find(self, rugged_ref.target)
Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit) Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target, target_commit)
...@@ -1624,7 +1622,6 @@ module Gitlab ...@@ -1624,7 +1622,6 @@ module Gitlab
# Omit invalid branch # Omit invalid branch
end end
end.compact end.compact
end
sort_branches(branches, sort_by) sort_branches(branches, sort_by)
end end
......
...@@ -14,7 +14,7 @@ module QA ...@@ -14,7 +14,7 @@ module QA
end end
scenario 'submit request with a valid user name' do scenario 'submit request with a valid user name' do
get request.url, { params: { username: 'root' } } get request.url, { params: { username: Runtime::User.name } }
expect_status(200) expect_status(200)
expect(json_body).to be_an Array expect(json_body).to be_an Array
...@@ -23,7 +23,7 @@ module QA ...@@ -23,7 +23,7 @@ module QA
end end
scenario 'submit request with an invalid user name' do scenario 'submit request with an invalid user name' do
get request.url, { params: { username: 'invalid' } } get request.url, { params: { username: SecureRandom.hex(10) } }
expect_status(200) expect_status(200)
expect(json_body).to be_an Array expect(json_body).to be_an Array
......
...@@ -3,16 +3,19 @@ require 'spec_helper' ...@@ -3,16 +3,19 @@ require 'spec_helper'
describe 'CI Lint', :js do describe 'CI Lint', :js do
before do before do
sign_in(create(:user)) sign_in(create(:user))
visit ci_lint_path
find('#ci-editor')
execute_script("ace.edit('ci-editor').setValue(#{yaml_content.to_json});")
# Ace editor updates a hidden textarea and it happens asynchronously
wait_for('YAML content') do
find('.ace_content').text.present?
end
end end
describe 'YAML parsing' do describe 'YAML parsing' do
before do before do
visit ci_lint_path
# Ace editor updates a hidden textarea and it happens asynchronously
# `sleep 0.1` is actually needed here because of this
find('#ci-editor')
execute_script("ace.edit('ci-editor').setValue(" + yaml_content.to_json + ");")
sleep 0.1
click_on 'Validate' click_on 'Validate'
end end
...@@ -32,11 +35,10 @@ describe 'CI Lint', :js do ...@@ -32,11 +35,10 @@ describe 'CI Lint', :js do
end end
context 'YAML is incorrect' do context 'YAML is incorrect' do
let(:yaml_content) { '' } let(:yaml_content) { 'value: cannot have :' }
it 'displays information about an error' do it 'displays information about an error' do
expect(page).to have_content('Status: syntax is incorrect') expect(page).to have_content('Status: syntax is incorrect')
expect(page).to have_content('Error: Please provide content of .gitlab-ci.yml')
end end
end end
...@@ -48,4 +50,20 @@ describe 'CI Lint', :js do ...@@ -48,4 +50,20 @@ describe 'CI Lint', :js do
end end
end end
end end
describe 'YAML clearing' do
before do
click_on 'Clear'
end
context 'YAML is present' do
let(:yaml_content) do
File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
end
it 'YAML content is cleared' do
expect(page).to have_field('content', with: '', visible: false, type: 'textarea')
end
end
end
end end
...@@ -215,6 +215,17 @@ describe Namespace do ...@@ -215,6 +215,17 @@ describe Namespace do
FileUtils.mkdir_p(File.join(uploads_dir, project.full_path)) FileUtils.mkdir_p(File.join(uploads_dir, project.full_path))
FileUtils.mkdir_p(File.join(pages_dir, project.full_path)) FileUtils.mkdir_p(File.join(pages_dir, project.full_path))
end end
<<<<<<< HEAD
context 'renaming child' do
it 'correctly moves the repository, uploads and pages' do
expected_repository_path = File.join(TestEnv.repos_path, 'parent', 'renamed', 'the-project.git')
expected_upload_path = File.join(uploads_dir, 'parent', 'renamed', 'the-project')
expected_pages_path = File.join(pages_dir, 'parent', 'renamed', 'the-project')
child.update_attributes!(path: 'renamed')
=======
context 'renaming child' do context 'renaming child' do
it 'correctly moves the repository, uploads and pages' do it 'correctly moves the repository, uploads and pages' do
...@@ -238,11 +249,44 @@ describe Namespace do ...@@ -238,11 +249,44 @@ describe Namespace do
parent.update_attributes!(path: 'renamed') parent.update_attributes!(path: 'renamed')
>>>>>>> upstream/master
expect(File.directory?(expected_repository_path)).to be(true) expect(File.directory?(expected_repository_path)).to be(true)
expect(File.directory?(expected_upload_path)).to be(true) expect(File.directory?(expected_upload_path)).to be(true)
expect(File.directory?(expected_pages_path)).to be(true) expect(File.directory?(expected_pages_path)).to be(true)
end end
end end
<<<<<<< HEAD
context 'renaming parent' do
it 'correctly moves the repository, uploads and pages' do
expected_repository_path = File.join(TestEnv.repos_path, 'renamed', 'child', 'the-project.git')
expected_upload_path = File.join(uploads_dir, 'renamed', 'child', 'the-project')
expected_pages_path = File.join(pages_dir, 'renamed', 'child', 'the-project')
parent.update_attributes!(path: 'renamed')
expect(File.directory?(expected_repository_path)).to be(true)
expect(File.directory?(expected_upload_path)).to be(true)
expect(File.directory?(expected_pages_path)).to be(true)
end
end
=======
end
end
context 'hashed storage' do
let(:namespace) { create(:namespace) }
let!(:project) { create(:project_empty_repo, namespace: namespace) }
it_behaves_like 'namespace restrictions'
it "repository directory remains unchanged if path changed" do
before_disk_path = project.disk_path
namespace.update_attributes(path: namespace.full_path + '_new')
expect(before_disk_path).to eq(project.disk_path)
expect(gitlab_shell.exists?(project.repository_storage_path, "#{project.disk_path}.git")).to be_truthy
>>>>>>> upstream/master
end end
end end
...@@ -350,9 +394,15 @@ describe Namespace do ...@@ -350,9 +394,15 @@ describe Namespace do
it 'has no repositories base directories to remove' do it 'has no repositories base directories to remove' do
allow(GitlabShellWorker).to receive(:perform_in) allow(GitlabShellWorker).to receive(:perform_in)
<<<<<<< HEAD
expect(File.exist?(path_in_dir)).to be(false)
=======
expect(File.exist?(path_in_dir)).to be(false) expect(File.exist?(path_in_dir)).to be(false)
>>>>>>> upstream/master
namespace.destroy namespace.destroy
expect(File.exist?(deleted_path_in_dir)).to be(false) expect(File.exist?(deleted_path_in_dir)).to be(false)
......
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