From 32499e8276c936ddc0a3c951413b6f73cbdae00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Ab=C3=A9lard?= Date: Sat, 11 Jan 2014 09:54:05 +0000 Subject: [PATCH 001/237] allow using the user's email address as a http parameter in gravatar urls for custom avatar systems. For example: plain_url: "http://avatar.company.com/avatar/?mail=%{email}&size=%{size}" --- app/helpers/application_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0db43fa1809..354bdd8e42e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -66,7 +66,7 @@ module ApplicationHelper else gravatar_url = request.ssl? || gitlab_config.https ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url user_email.strip! - sprintf gravatar_url, hash: Digest::MD5.hexdigest(user_email.downcase), size: size + sprintf gravatar_url, hash: Digest::MD5.hexdigest(user_email.downcase), size: size, email: user_email end end @@ -221,4 +221,4 @@ module ApplicationHelper def render_markup(file_name, file_content) GitHub::Markup.render(file_name, file_content).html_safe end -end +end \ No newline at end of file -- GitLab From 556ae5ae8187b89a3785219d5621e7ebc9bb7a8c Mon Sep 17 00:00:00 2001 From: Javier Castro Date: Tue, 14 Jan 2014 12:06:53 -0300 Subject: [PATCH 002/237] Temporary fix for #4305: Cant preview attached png images on notes; attachment.secure_url returns an url which is accessible --- app/views/events/event/_note.html.haml | 4 ++-- app/views/projects/notes/_note.html.haml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/events/event/_note.html.haml b/app/views/events/event/_note.html.haml index db5f3ebb00f..ad2afbce14c 100644 --- a/app/views/events/event/_note.html.haml +++ b/app/views/events/event/_note.html.haml @@ -14,8 +14,8 @@ - note = event.target - if note.attachment.url - if note.attachment.image? - = link_to note.attachment.url, target: '_blank' do - = image_tag note.attachment.url, class: 'note-image-attach' + = link_to note.attachment.secure_url, target: '_blank' do + = image_tag note.attachment.secure_url, class: 'note-image-attach' - else = link_to note.attachment.secure_url, target: "_blank", class: 'note-file-attach' do %i.icon-paper-clip diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml index fd2a3f43674..be9c6ca79bb 100644 --- a/app/views/projects/notes/_note.html.haml +++ b/app/views/projects/notes/_note.html.haml @@ -54,8 +54,8 @@ - if note.attachment.url .note-attachment - if note.attachment.image? - = link_to note.attachment.url, target: '_blank' do - = image_tag note.attachment.url, class: 'note-image-attach' + = link_to note.attachment.secure_url, target: '_blank' do + = image_tag note.attachment.secure_url, class: 'note-image-attach' .attachment.pull-right = link_to note.attachment.secure_url, target: "_blank" do %i.icon-paper-clip -- GitLab From 301c4068e13c838368fa2f5d9e2e9af2b2124c23 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Sat, 5 Apr 2014 20:31:07 +0100 Subject: [PATCH 003/237] Add rake task to install or upgrade gitlab-shell installation. --- lib/tasks/gitlab/shell.rake | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 08de0f2dd5d..2fcc889d883 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -1,5 +1,63 @@ namespace :gitlab do namespace :shell do + desc "GITLAB | Install or upgrade gitlab-shell" + task :install, [:tag, :repo] => :environment do |t, args| + warn_user_is_not_gitlab + + args.with_defaults(tag: "v1.9.1", repo: "https://gitlab.com/gitlab-org/gitlab-shell.git") + + user = Settings.gitlab.user + home_dir = Settings.gitlab.user_home + gitlab_url = Settings.gitlab.url + # gitlab-shell requires a / at the end of the url + gitlab_url += "/" unless gitlab_url.match(/\/$/) + target_dir = File.join(home_dir, "gitlab-shell") + + # Clone if needed + unless File.directory?(target_dir) + sh "git clone '#{args.repo}' '#{target_dir}'" + end + + # Make sure we're on the right tag + Dir.chdir(target_dir) do + sh "git fetch origin && git reset --hard $(git describe #{args.tag} || git describe origin/#{args.tag})" + + redis_url = URI.parse(ENV['REDIS_URL'] || "redis://localhost:6379") + + config = { + user: user, + gitlab_url: gitlab_url, + http_settings: {self_signed_cert: false}, + repos_path: File.join(home_dir, "repositories"), + auth_file: File.join(home_dir, ".ssh", "authorized_keys"), + redis: { + bin: %x{which redis-cli}.chomp, + host: redis_url.host, + port: redis_url.port, + namespace: "resque:gitlab" + }, + log_level: "INFO", + audit_usernames: false + } + + # Generate config.yml based on existing gitlab settings + File.open("config.yml", "w+") {|f| f.puts config.to_yaml} + + # Launch installation process + sh "bin/install" + end + + # Required for debian packaging with PKGR: Setup .ssh/environment with + # the current PATH, so that the correct ruby version gets loaded + # Requires to set "PermitUserEnvironment yes" in sshd config (should not + # be an issue since it is more than likely that there are no "normal" + # user accounts on a gitlab server). The alternative is for the admin to + # install a ruby (1.9.3+) in the global path. + File.open(File.join(home_dir, ".ssh", "environment"), "w+") do |f| + f.puts "PATH=#{ENV['PATH']}" + end + end + desc "GITLAB | Setup gitlab-shell" task setup: :environment do setup -- GitLab From 8af8bee4538baa703085ccc2f44df2c967618ca4 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Tue, 8 Apr 2014 15:43:21 +0100 Subject: [PATCH 004/237] Add documentation for new rake task to install gitlab-shell. --- doc/install/installation.md | 41 ++++++++++++++----------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index e1fa822f7d6..54527a89504 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -119,30 +119,7 @@ Create a `git` user for Gitlab: sudo adduser --disabled-login --gecos 'GitLab' git - -# 4. GitLab shell - -GitLab Shell is an ssh access and repository management software developed specially for GitLab. - - # Go to home directory - cd /home/git - - # Clone gitlab shell - sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.1 - - cd gitlab-shell - - sudo -u git -H cp config.yml.example config.yml - - # Edit config and replace gitlab_url - # with something like 'http://domain.com/' - sudo -u git -H editor config.yml - - # Do setup - sudo -u git -H ./bin/install - - -# 5. Database +# 4. Database We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](database_mysql.md). @@ -165,7 +142,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da sudo -u git -H psql -d gitlabhq_production -# 6. GitLab +# 5. GitLab # We'll install GitLab into home directory of the user "git" cd /home/git @@ -275,6 +252,18 @@ that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. # When done you see 'Administrator account created:' +## Install GitLab shell + +GitLab Shell is an ssh access and repository management software developed specially for GitLab. + + # Go to the Gitlab installation folder: + cd /home/git/gitlab + + # Run the installation task for gitlab-shell (replace `REDIS_URL` if needed): + sudo -u git -H bundle exec rake gitlab:shell:setup[v1.9.1] REDIS_URL=redis://localhost:6379 + + # By default, the gitlab-shell config is generated from your main gitlab config. You can review (and modify) it as follows: + sudo -u git -H editor /home/git/gitlab-shell/config.yml ## Install Init Script @@ -314,7 +303,7 @@ Check if GitLab and its environment are configured correctly: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production -# 7. Nginx +# 6. Nginx **Note:** Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the -- GitLab From 8419a2a4ebf79631f712f3066b8a9d4594fe9666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Ab=C3=A9lard?= Date: Thu, 10 Apr 2014 14:17:25 +0000 Subject: [PATCH 005/237] add mentions of the different placeholders possible for gravatar urls, mentionning the new %{email} --- config/gitlab.yml.example | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 2bc984c9294..d5a7c1cadcf 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -108,6 +108,7 @@ production: &base ## Gravatar gravatar: enabled: true # Use user avatar image from Gravatar.com (default: true) + # gravatar urls: possible placeholders: %{hash} %{size} %{email} # plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm # ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm @@ -224,4 +225,4 @@ test: new_issue_url: "http://redmine/projects/:issues_tracker_id/issues/new" staging: - <<: *base + <<: *base \ No newline at end of file -- GitLab From 5d7bdf76426488f3229bb1f97aaa54a676cbf166 Mon Sep 17 00:00:00 2001 From: Arnaud ABELARD Date: Sat, 12 Apr 2014 23:10:45 +0200 Subject: [PATCH 006/237] allow using the user's email address as a http parameter in gravatar urls for custom avatar systems. For example: plain_url: "http://avatar.company.com/avatar/?mail=%{email}&size=%{size}" add mention of the different placeholders possible for gravatar urls, mentionning the new %{email} --- app/helpers/application_helper.rb | 2 +- config/gitlab.yml.example | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index faecde299c1..5f07cdf448c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -75,7 +75,7 @@ module ApplicationHelper else gravatar_url = request.ssl? || gitlab_config.https ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url user_email.strip! - sprintf gravatar_url, hash: Digest::MD5.hexdigest(user_email.downcase), size: size + sprintf gravatar_url, hash: Digest::MD5.hexdigest(user_email.downcase), size: size, email: user_email end end diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index f30ef528c9d..11df7a5ff15 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -117,6 +117,7 @@ production: &base ## Gravatar gravatar: enabled: true # Use user avatar image from Gravatar.com (default: true) + # gravatar urls: possible placeholders: %{hash} %{size} %{email} # plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm # ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm -- GitLab From 6b068dccbb441127fd33319f6c56c43e59026182 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Mon, 14 Apr 2014 23:49:16 +0200 Subject: [PATCH 007/237] Include SASS in subdirectories with glob. --- app/assets/stylesheets/application.scss | 55 +++---------------------- 1 file changed, 5 insertions(+), 50 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index ce36c1132ea..c53873f95a2 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -12,10 +12,7 @@ *= require nprogress-bootstrap */ -@import "main/variables.scss"; -@import "main/mixins.scss"; -@import "main/fonts.scss"; -@import "main/layout.scss"; +@import "main/*"; /** * Customized Twitter bootstrap @@ -31,64 +28,22 @@ /** * Generic css (forms, nav etc): */ -@import "generic/avatar.scss"; -@import "generic/common.scss"; -@import "generic/typography.scss"; -@import "generic/buttons.scss"; -@import "generic/blocks.scss"; -@import "generic/ui_box.scss"; -@import "generic/issue_box.scss"; -@import "generic/files.scss"; -@import "generic/lists.scss"; -@import "generic/flash.scss"; -@import "generic/forms.scss"; -@import "generic/selects.scss"; -@import "generic/highlight.scss"; -@import "generic/jquery.scss"; +@import "generic/*"; /** * Page specific styles (issues, projects etc): */ -@import "sections/header.scss"; -@import "sections/nav.scss"; -@import "sections/commits.scss"; -@import "sections/diff.scss"; -@import "sections/issues.scss"; -@import "sections/projects.scss"; -@import "sections/snippets.scss"; -@import "sections/votes.scss"; -@import "sections/merge_requests.scss"; -@import "sections/graph.scss"; -@import "sections/events.scss"; -@import "sections/themes.scss"; -@import "sections/tree.scss"; -@import "sections/notes.scss"; -@import "sections/profile.scss"; -@import "sections/login.scss"; -@import "sections/editor.scss"; -@import "sections/admin.scss"; -@import "sections/wiki.scss"; -@import "sections/wall.scss"; -@import "sections/dashboard.scss"; -@import "sections/stat_graph.scss"; -@import "sections/groups.scss"; +@import "sections/*"; /** * Code highlight */ -@import "highlight/white.scss"; -@import "highlight/dark.scss"; -@import "highlight/solarized_dark.scss"; -@import "highlight/monokai.scss"; +@import "highlight/*"; /** * UI themes: */ -@import "themes/ui_basic.scss"; -@import "themes/ui_mars.scss"; -@import "themes/ui_modern.scss"; -@import "themes/ui_gray.scss"; -@import "themes/ui_color.scss"; +@import "themes/*"; /** * Styles for JS behaviors. -- GitLab From 8d78662e69a11dc82916793d97aba36dacae1440 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 15 Apr 2014 12:11:13 +0200 Subject: [PATCH 008/237] Give the Rails cache its own Redis namespace Before this change, Rails cache data was stored in a global Redis namespace. As a consequence, clearing the Rails cache (`rake cache:clear`) would also delete all Sidekiq queue data and session storage. This change puts all Rails cache data in a `cache:gitlab` namespace, making `rake cache:clear` safe again. --- CHANGELOG | 1 + config/environments/production.rb | 2 +- config/initializers/session_store.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3ef46f4484e..25067d3abe2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -17,6 +17,7 @@ v 6.8.0 - Fix download link for huge MR diffs - Expose event and mergerequest timestamps in API - Fix emails on push service when only one commit is pushed + - Store Rails cache data in the Redis `cache:gitlab` namespace v 6.7.3 - Fix the merge notification email not being sent (Pierre de La Morinerie) diff --git a/config/environments/production.rb b/config/environments/production.rb index ad3c03d8fc9..47f7e17aeb6 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -53,7 +53,7 @@ Gitlab::Application.configure do else "redis://localhost:6379" end - config.cache_store = :redis_store, resque_url + config.cache_store = :redis_store, resque_url, {namespace: 'cache:gitlab'} # Enable serving of images, stylesheets, and JavaScripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index f80b67a554b..5fe5270236b 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -2,7 +2,7 @@ Gitlab::Application.config.session_store( :redis_store, # Using the cookie_store would enable session replay attacks. - servers: Gitlab::Application.config.cache_store.last, # re-use the Redis config from the Rails cache store + servers: Gitlab::Application.config.cache_store[1], # re-use the Redis config from the Rails cache store key: '_gitlab_session', secure: Gitlab.config.gitlab.https, httponly: true, -- GitLab From d859d080942175082c1a0cf34d89c0eefd1a3c39 Mon Sep 17 00:00:00 2001 From: skv-headless Date: Tue, 15 Apr 2014 19:02:02 +0400 Subject: [PATCH 009/237] Editing preview --- Gemfile | 3 ++ Gemfile.lock | 6 ++-- app/assets/stylesheets/generic/files.scss | 4 +++ .../projects/edit_tree_controller.rb | 12 +++++++ app/helpers/commits_helper.rb | 7 ++-- app/helpers/tree_helper.rb | 8 +++++ app/models/note.rb | 7 ++-- app/views/projects/edit_tree/_diff.html.haml | 13 ++++++++ .../projects/edit_tree/preview.html.haml | 26 +++++++++++++++ app/views/projects/edit_tree/show.html.haml | 33 +++++++++++++++++-- config/routes.rb | 4 ++- db/schema.rb | 2 +- features/project/source/browse_files.feature | 10 ++++++ features/steps/project/browse_files.rb | 12 +++++++ lib/gitlab/diff_parser.rb | 20 +++++++---- 15 files changed, 148 insertions(+), 19 deletions(-) create mode 100644 app/views/projects/edit_tree/_diff.html.haml create mode 100644 app/views/projects/edit_tree/preview.html.haml diff --git a/Gemfile b/Gemfile index 4ab1ab50eb9..2f1347879cd 100644 --- a/Gemfile +++ b/Gemfile @@ -82,6 +82,9 @@ gem "seed-fu" gem "redcarpet", "~> 2.2.2" gem "github-markup" +# Diffs +gem 'diffy', '~> 3.0.3' + # Asciidoc to HTML gem "asciidoctor" diff --git a/Gemfile.lock b/Gemfile.lock index 7682540eba0..60329b40a62 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -101,6 +101,7 @@ GEM devise-async (0.8.0) devise (>= 2.2, < 3.2) diff-lcs (1.2.5) + diffy (3.0.3) docile (1.1.1) dotenv (0.9.0) email_spec (1.5.0) @@ -574,6 +575,7 @@ DEPENDENCIES default_value_for (~> 3.0.0) devise (= 3.0.4) devise-async (= 0.8.0) + diffy (~> 3.0.3) email_spec email_validator (~> 1.4.0) enumerize @@ -644,7 +646,7 @@ DEPENDENCIES simplecov sinatra six - slack-notifier (~> 0.2.0) + slack-notifier (~> 0.3.2) slim spinach-rails spring (= 1.1.1) @@ -662,4 +664,4 @@ DEPENDENCIES unicorn (~> 4.6.3) unicorn-worker-killer version_sorter - webmock \ No newline at end of file + webmock diff --git a/app/assets/stylesheets/generic/files.scss b/app/assets/stylesheets/generic/files.scss index 12559f76051..6418f24d97f 100644 --- a/app/assets/stylesheets/generic/files.scss +++ b/app/assets/stylesheets/generic/files.scss @@ -26,6 +26,10 @@ margin-top: -5px; } + .left-options { + margin-top: -3px; + } + .file_name { color: $style_color; font-size: 14px; diff --git a/app/controllers/projects/edit_tree_controller.rb b/app/controllers/projects/edit_tree_controller.rb index ff5206b6fa1..be611892bb0 100644 --- a/app/controllers/projects/edit_tree_controller.rb +++ b/app/controllers/projects/edit_tree_controller.rb @@ -26,6 +26,18 @@ class Projects::EditTreeController < Projects::BaseTreeController end end + def preview + @content = params[:content] + #FIXME workaround https://github.com/gitlabhq/gitlabhq/issues/5936 + @content += "\n" if @blob.data.end_with?("\n") + + diffy = Diffy::Diff.new(@blob.data, @content, diff: '-U 3', + include_diff_info: true) + @diff = Gitlab::DiffParser.new(diffy.diff.scan(/.*\n/)) + + render layout: false + end + private def blob diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index c6e4f574b67..de081acc2ba 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -16,9 +16,10 @@ module CommitsHelper end def each_diff_line(diff, index) - Gitlab::DiffParser.new(diff).each do |full_line, type, line_code, line_new, line_old| - yield(full_line, type, line_code, line_new, line_old) - end + Gitlab::DiffParser.new(diff.diff.lines.to_a, diff.new_path) + .each do |full_line, type, line_code, line_new, line_old| + yield(full_line, type, line_code, line_new, line_old) + end end def each_diff_line_near(diff, index, expected_line_code) diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index 50501dffefb..f39d0081dce 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -91,4 +91,12 @@ module TreeHelper def leave_edit_message "Leave edit mode?\nAll unsaved changes will be lost." end + + def editing_preview_title(filename) + if gitlab_markdown?(filename) || markup?(filename) + 'Preview' + else + 'Diff' + end + end end diff --git a/app/models/note.rb b/app/models/note.rb index 6f7afcd1f9f..cee10ec90d2 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -184,9 +184,10 @@ class Note < ActiveRecord::Base return @diff_line if @diff_line if diff - Gitlab::DiffParser.new(diff).each do |full_line, type, line_code, line_new, line_old| - @diff_line = full_line if line_code == self.line_code - end + Gitlab::DiffParser.new(diff.diff.lines.to_a, diff.new_path) + .each do |full_line, type, line_code, line_new, line_old| + @diff_line = full_line if line_code == self.line_code + end end @diff_line diff --git a/app/views/projects/edit_tree/_diff.html.haml b/app/views/projects/edit_tree/_diff.html.haml new file mode 100644 index 00000000000..cf044feb9a4 --- /dev/null +++ b/app/views/projects/edit_tree/_diff.html.haml @@ -0,0 +1,13 @@ +%table.text-file + - each_diff_line(diff, 1) do |line, type, line_code, line_new, line_old, raw_line| + %tr.line_holder{ id: line_code, class: "#{type}" } + - if type == "match" + %td.old_line= "..." + %td.new_line= "..." + %td.line_content.matched= line + - else + %td.old_line + = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code + %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code + %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line) + diff --git a/app/views/projects/edit_tree/preview.html.haml b/app/views/projects/edit_tree/preview.html.haml new file mode 100644 index 00000000000..fc6d3bfbc24 --- /dev/null +++ b/app/views/projects/edit_tree/preview.html.haml @@ -0,0 +1,26 @@ +.diff-file + .diff-content + - if gitlab_markdown?(@blob.name) + .file-content.wiki + = preserve do + = markdown(@content) + - elsif markup?(@blob.name) + .file-content.wiki + = raw GitHub::Markup.render(@blob.name, @content) + - else + .file-content.code + - unless @diff.empty? + %table.text-file + - @diff.each do |line, type, line_code, line_new, line_old, raw_line| + %tr.line_holder{ id: line_code, class: "#{type}" } + - if type == "match" + %td.old_line= "..." + %td.new_line= "..." + %td.line_content.matched= line + - else + %td.old_line + = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code + %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code + %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line) + - else + %p.nothing_here_message No changes. diff --git a/app/views/projects/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml index 3f2e98f3a7f..48babb43aaf 100644 --- a/app/views/projects/edit_tree/show.html.haml +++ b/app/views/projects/edit_tree/show.html.haml @@ -1,8 +1,11 @@ %h3.page-title Edit mode .file-editor = form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do - .file-holder + .file-holder.file .file-title + .btn-group.js-edit-mode.left-options + = link_to 'Edit', '#editor', class: 'active hover btn btn-tiny' + = link_to editing_preview_title(@blob.name), '#preview', class: 'btn btn-tiny', 'data-preview-url' => preview_project_edit_tree_path(@project, @id) %i.icon-file %span.file_name = @path @@ -13,7 +16,8 @@ .btn-group.tree-btn-group = link_to "Cancel", @after_edit_path, class: "btn btn-tiny btn-cancel", data: { confirm: leave_edit_message } .file-content.code - %pre#editor= @blob.data + %pre.js-edit-mode-pane#editor= @blob.data + .js-edit-mode-pane#preview.hide .form-group.commit_message-group = label_tag 'commit_message', class: "control-label" do @@ -45,3 +49,28 @@ $("#file-content").val(editor.getValue()); $(".file-editor form").submit(); }); + + var editModePanes = $('.js-edit-mode-pane'), + editModeLinks = $('.js-edit-mode a'); + + editModeLinks.click(function(event) { + event.preventDefault(); + + var currentLink = $(this), + paneId = currentLink.attr('href'), + currentPane = editModePanes.filter(paneId); + + editModeLinks.removeClass('active hover'); + currentLink.addClass('active hover'); + editModePanes.hide(); + + if (paneId == '#preview') { + $.post(currentLink.data('preview-url'), { content: editor.getValue() }, function(response) { + currentPane.empty().append(response); + currentPane.fadeIn(200); + }) + } else { + currentPane.fadeIn(200); + editor.focus() + } + }) diff --git a/config/routes.rb b/config/routes.rb index f23542cc893..910c9ec2393 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -187,7 +187,9 @@ Gitlab::Application.routes.draw do resources :blob, only: [:show, :destroy], constraints: {id: /.+/} resources :raw, only: [:show], constraints: {id: /.+/} resources :tree, only: [:show], constraints: {id: /.+/, format: /(html|js)/ } - resources :edit_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'edit' + resources :edit_tree, only: [:show, :update], constraints: { id: /.+/ }, path: 'edit' do + post :preview, on: :member + end resources :new_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'new' resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} resources :commits, only: [:show], constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} diff --git a/db/schema.rb b/db/schema.rb index 265d556bd27..dbd489335db 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -319,7 +319,6 @@ ActiveRecord::Schema.define(version: 20140414131055) do t.integer "notification_level", default: 1, null: false t.datetime "password_expires_at" t.integer "created_by_id" - t.datetime "last_credential_check_at" t.string "avatar" t.string "confirmation_token" t.datetime "confirmed_at" @@ -327,6 +326,7 @@ ActiveRecord::Schema.define(version: 20140414131055) do t.string "unconfirmed_email" t.boolean "hide_no_ssh_key", default: false t.string "website_url", default: "", null: false + t.datetime "last_credential_check_at" end add_index "users", ["admin"], name: "index_users_on_admin", using: :btree diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature index fd9a2f01a28..a204c3e10c7 100644 --- a/features/project/source/browse_files.feature +++ b/features/project/source/browse_files.feature @@ -29,3 +29,13 @@ Feature: Project Browse files Given I click on "Gemfile.lock" file in repo And I click button "edit" Then I can edit code + + @javascript + Scenario: I can see editing preview + Given I click on "Gemfile.lock" file in repo + And I click button "edit" + And I edit code + And I click link "Diff" + Then I see diff + + diff --git a/features/steps/project/browse_files.rb b/features/steps/project/browse_files.rb index 069086d5eac..7cdd1101ac5 100644 --- a/features/steps/project/browse_files.rb +++ b/features/steps/project/browse_files.rb @@ -41,6 +41,18 @@ class ProjectBrowseFiles < Spinach::FeatureSteps page.evaluate_script('editor.getValue()').should == "GitlabFileEditor" end + step 'I edit code' do + page.execute_script('editor.setValue("GitlabFileEditor")') + end + + step 'I click link "Diff"' do + click_link 'Diff' + end + + step 'I see diff' do + page.should have_css '.line_holder.new' + end + step 'I click on "new file" link in repo' do click_link 'new-file-link' end diff --git a/lib/gitlab/diff_parser.rb b/lib/gitlab/diff_parser.rb index fb27280c4a4..14bbb328637 100644 --- a/lib/gitlab/diff_parser.rb +++ b/lib/gitlab/diff_parser.rb @@ -4,9 +4,9 @@ module Gitlab attr_reader :lines, :new_path - def initialize(diff) - @lines = diff.diff.lines.to_a - @new_path = diff.new_path + def initialize(lines, new_path = '') + @lines = lines + @new_path = new_path end def each @@ -18,10 +18,7 @@ module Gitlab lines_arr.each do |line| raw_line = line.dup - next if line.match(/^\-\-\- \/dev\/null/) - next if line.match(/^\+\+\+ \/dev\/null/) - next if line.match(/^\-\-\- a/) - next if line.match(/^\+\+\+ b/) + next if filename?(line) full_line = html_escape(line.gsub(/\n/, '')) full_line = ::Gitlab::InlineDiff.replace_markers full_line @@ -53,8 +50,17 @@ module Gitlab end end + def empty? + @lines.empty? + end + private + def filename?(line) + line.start_with?('--- /dev/null', '+++ /dev/null', '--- a', '+++ b', + '--- /tmp/diffy', '+++ /tmp/diffy') + end + def identification_type(line) if line[0] == "+" "new" -- GitLab From 7f13afdc0aa67de5da7c5ba9bb73dcd786ca284b Mon Sep 17 00:00:00 2001 From: Ricardo Melo Date: Wed, 16 Apr 2014 19:07:26 +0100 Subject: [PATCH 010/237] Fix typo in documentation --- doc/permissions/permissions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/permissions/permissions.md b/doc/permissions/permissions.md index ac4bdefddd5..9be6423f667 100644 --- a/doc/permissions/permissions.md +++ b/doc/permissions/permissions.md @@ -27,7 +27,7 @@ If a user is a GitLab administrator they receive all permissions. |Remove protected branches| |||✓|✓| |Edit project| |||✓|✓| |Add Deploy Keys to project| |||✓|✓| -|Confiure Project Hooks| |||✓|✓| +|Configure Project Hooks| |||✓|✓| |Switch visibility level| ||||✓| |Transfer project to another namespace| ||||✓| |Remove project| ||||✓| -- GitLab From cf43bf3620f7b2600f5af168f7bf56c0129924f2 Mon Sep 17 00:00:00 2001 From: GitLab Date: Wed, 16 Apr 2014 21:03:54 +0200 Subject: [PATCH 011/237] Add db index for active user display. --- CHANGELOG | 3 +++ db/migrate/20140416185734_index_on_current_sign_in_at.rb | 5 +++++ db/schema.rb | 1 + 3 files changed, 9 insertions(+) create mode 100644 db/migrate/20140416185734_index_on_current_sign_in_at.rb diff --git a/CHANGELOG b/CHANGELOG index 3ef46f4484e..fa8aba81a38 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +v 6.9.0 + - View active users in the admin dashboard + v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion - Enabled GZip Compression for assets in example Nginx, make sure that Nginx is compiled with --with-http_gzip_static_module flag (this is default in Ubuntu) diff --git a/db/migrate/20140416185734_index_on_current_sign_in_at.rb b/db/migrate/20140416185734_index_on_current_sign_in_at.rb new file mode 100644 index 00000000000..0bf80ce154a --- /dev/null +++ b/db/migrate/20140416185734_index_on_current_sign_in_at.rb @@ -0,0 +1,5 @@ +class IndexOnCurrentSignInAt < ActiveRecord::Migration + def change + add_index :users, :current_sign_in_at + end +end diff --git a/db/schema.rb b/db/schema.rb index 265d556bd27..0d3923b35c3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -332,6 +332,7 @@ ActiveRecord::Schema.define(version: 20140414131055) do add_index "users", ["admin"], name: "index_users_on_admin", using: :btree add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree + add_index "users", ["current_sign_in_at"], name: "index_users_on_current_sign_in_at", using: :btree add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree add_index "users", ["extern_uid", "provider"], name: "index_users_on_extern_uid_and_provider", unique: true, using: :btree add_index "users", ["name"], name: "index_users_on_name", using: :btree -- GitLab From 7ee0a94e8bd4da8862fab0ec2e8b7ccc0a2581f9 Mon Sep 17 00:00:00 2001 From: GitLab Date: Wed, 16 Apr 2014 21:14:40 +0200 Subject: [PATCH 012/237] Don't update the changelog since the feature landed in 6.8. --- CHANGELOG | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index fa8aba81a38..3ef46f4484e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,3 @@ -v 6.9.0 - - View active users in the admin dashboard - v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion - Enabled GZip Compression for assets in example Nginx, make sure that Nginx is compiled with --with-http_gzip_static_module flag (this is default in Ubuntu) -- GitLab From 07a9d44de7a54b2cd1bffd9fcc830f7b2a03b549 Mon Sep 17 00:00:00 2001 From: Ciro Santillli Date: Sat, 22 Feb 2014 20:27:23 +0100 Subject: [PATCH 013/237] Commit message textareas have 72 char mark line. --- app/assets/stylesheets/generic/forms.scss | 23 +++++++++++++++++++ app/assets/stylesheets/sections/tree.scss | 2 ++ app/views/projects/blob/_remove.html.haml | 3 ++- app/views/projects/edit_tree/show.html.haml | 3 ++- .../merge_requests/show/_mr_accept.html.haml | 4 ++-- app/views/projects/new_tree/show.html.haml | 3 ++- .../_commit_message_container.html.haml | 5 ++++ 7 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 app/views/shared/_commit_message_container.html.haml diff --git a/app/assets/stylesheets/generic/forms.scss b/app/assets/stylesheets/generic/forms.scss index 56cd4db905e..36551f85b6a 100644 --- a/app/assets/stylesheets/generic/forms.scss +++ b/app/assets/stylesheets/generic/forms.scss @@ -75,3 +75,26 @@ label { width: 200px; } } + +.commit-message-container { + background-color: $body-bg; + position: relative; + font-family: $monospace_font; + $left: 12px; + .max-width-marker { + color: rgba(0, 0, 0, 0.0); + font-family: inherit; + left: $left; + height: 100%; + border-right: 1px solid mix($input-border, white); + position: absolute; + z-index: 1; + } + > textarea { + background-color: rgba(0, 0, 0, 0.0); + font-family: inherit; + padding-left: $left; + position: relative; + z-index: 2; + } +} diff --git a/app/assets/stylesheets/sections/tree.scss b/app/assets/stylesheets/sections/tree.scss index 55a5819b55a..86e2a51641a 100644 --- a/app/assets/stylesheets/sections/tree.scss +++ b/app/assets/stylesheets/sections/tree.scss @@ -151,3 +151,5 @@ } } } + +#modal-remove-blob > .modal-dialog { width: 850px; } diff --git a/app/views/projects/blob/_remove.html.haml b/app/views/projects/blob/_remove.html.haml index 6384703671a..692248dd233 100644 --- a/app/views/projects/blob/_remove.html.haml +++ b/app/views/projects/blob/_remove.html.haml @@ -14,7 +14,8 @@ = label_tag 'commit_message', class: "control-label" do Commit message .col-sm-10 - = text_area_tag 'commit_message', params[:commit_message], placeholder: "Removed this file because...", required: true, rows: 3, class: 'form-control' + = render 'shared/commit_message_container', {textarea: text_area_tag('commit_message', + params[:commit_message], placeholder: "Removed this file because...", required: true, rows: 3, class: 'form-control')} .form-group .col-sm-2 .col-sm-10 diff --git a/app/views/projects/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml index 3f2e98f3a7f..41a63493b2b 100644 --- a/app/views/projects/edit_tree/show.html.haml +++ b/app/views/projects/edit_tree/show.html.haml @@ -19,7 +19,8 @@ = label_tag 'commit_message', class: "control-label" do Commit message .col-sm-10 - = text_area_tag 'commit_message', '', placeholder: "Update #{@blob.name}", required: true, rows: 3, class: 'form-control' + = render 'shared/commit_message_container', {textarea: text_area_tag('commit_message', '', + placeholder: "Update #{@blob.name}", required: true, rows: 3, class: 'form-control')} .form-actions = hidden_field_tag 'last_commit', @last_commit = hidden_field_tag 'content', '', id: "file-content" diff --git a/app/views/projects/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml index 6594709f2ae..43157481f34 100644 --- a/app/views/projects/merge_requests/show/_mr_accept.html.haml +++ b/app/views/projects/merge_requests/show/_mr_accept.html.haml @@ -21,7 +21,6 @@ = link_to "click here", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal" for instructions. - .js-toggle-container %p If you want to modify merge commit message - @@ -31,7 +30,8 @@ .form-group = label_tag :merge_commit_message, "Commit message", class: 'control-label' .col-sm-10 - = text_area_tag :merge_commit_message, @merge_request.merge_commit_message, class: "form-control js-gfm-input", rows: 14, required: true + = render 'shared/commit_message_container', {textarea: text_area_tag(:merge_commit_message, + @merge_request.merge_commit_message, class: "form-control js-gfm-input", rows: 14, required: true)} %p.hint The recommended maximum line length is 52 characters for the first line and 72 characters for all following lines. diff --git a/app/views/projects/new_tree/show.html.haml b/app/views/projects/new_tree/show.html.haml index 9d7c7afbeac..9ecbbe7508e 100644 --- a/app/views/projects/new_tree/show.html.haml +++ b/app/views/projects/new_tree/show.html.haml @@ -24,7 +24,8 @@ = label_tag 'commit_message', class: "control-label" do Commit message .col-sm-10 - = text_area_tag 'commit_message', params[:commit_message], placeholder: "Added new file", required: true, rows: 3, class: 'form-control' + = render 'shared/commit_message_container', {textarea: text_area_tag('commit_message', + params[:commit_message], placeholder: "Added new file", required: true, rows: 3, class: 'form-control')} .file-holder .file-title diff --git a/app/views/shared/_commit_message_container.html.haml b/app/views/shared/_commit_message_container.html.haml new file mode 100644 index 00000000000..cca7a0efc9b --- /dev/null +++ b/app/views/shared/_commit_message_container.html.haml @@ -0,0 +1,5 @@ +.commit-message-container + .max-width-marker + -# When the `ch` CSS length unit becomes widely supported `http://www.quirksmode.org/css/units-values` remove this workaround. + = 'a' * 72 + = textarea -- GitLab From 5ef7fdbd54ef41de01b64b4df58529d4bf3c62a3 Mon Sep 17 00:00:00 2001 From: George Dewar Date: Thu, 17 Apr 2014 14:36:43 +1200 Subject: [PATCH 014/237] Fix bug in which a line count without empty lines was incorrectly used --- app/helpers/commits_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index c6e4f574b67..b02be4623fd 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -116,7 +116,7 @@ module CommitsHelper added_lines[line_new] = { line_code: line_code, type: type, line: line } end end - max_length = old_file ? old_file.sloc + added_lines.length : file.sloc + max_length = old_file ? [old_file.loc, file.loc].max : file.loc offset1 = 0 offset2 = 0 -- GitLab From f0a4f62c7eb0900ca1c3cdecffbacc46a72480d2 Mon Sep 17 00:00:00 2001 From: Job van der Voort Date: Tue, 15 Apr 2014 15:04:48 +0200 Subject: [PATCH 015/237] start writing deploy key to multiple projects --- doc/api/deploy_key_multiple_projects.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 doc/api/deploy_key_multiple_projects.md diff --git a/doc/api/deploy_key_multiple_projects.md b/doc/api/deploy_key_multiple_projects.md new file mode 100644 index 00000000000..56d8d513946 --- /dev/null +++ b/doc/api/deploy_key_multiple_projects.md @@ -0,0 +1,22 @@ +# Adding deploy keys to multiple projects + +If you want to easily add the same deploy key to multiple projects in the same group, this can be achieved quite easily with the API. + +First, find the ID of the projects you're interested in, by either listing all projects: + +``` +curl https://gitlab.com/api/v3/projects?private_token=abcdef +``` + +Or finding the id of a group and then listing all projects in that group: + +``` +curl https://gitlab.com/api/v3/groups?private_token=abcdef + +curl https://gitlab.com/api/v3/groups/1234?private_token=abcdef # where the id of the group is 1234 +``` + +With those IDs, add the same deploy key to all: +``` +curl -X POST curl https://gitlab.com/api/v3/projects/321/deploy_key_here?private_token=abcdef +``` -- GitLab From 556ddbcad49be5d59cd6275639ac149f5b2ee7ac Mon Sep 17 00:00:00 2001 From: GitLab Date: Fri, 18 Apr 2014 12:05:00 +0200 Subject: [PATCH 016/237] Add schema number change. --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 0d3923b35c3..e53a637af66 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140414131055) do +ActiveRecord::Schema.define(version: 20140416185734) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" -- GitLab From 05e792b4c492e04aaa7e301432f71e01d63c02bc Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Tue, 15 Apr 2014 16:39:46 +0200 Subject: [PATCH 017/237] Implement GET /users/:uid/keys for admin users Complements POST operation added in gitlabhq/gitlabhq#3146 Implement DELETE /users/:uid/keys/:id for admin users Fix "Line is too long. [83/80]" Use single quotes as advised Use single quotes as advised Use single quotes as advised Fix missing space around { and } Fix typo in documentation Only catch ActiveRecord::RecordNotFound, let other exceptions propagate Raise a "404 Not found" if key to be deleted cannot be found As requested by @jvanbaarsen in https://github.com/gitlabhq/gitlabhq/pull/6781#discussion_r11735114 Remove tab Unconfigured vim on this box, grrrr./ --- Gemfile.lock | 4 +-- doc/api/users.md | 27 +++++++++++++++ lib/api/users.rb | 39 +++++++++++++++++++++ spec/requests/api/users_spec.rb | 61 +++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7682540eba0..155e03e5456 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -644,7 +644,7 @@ DEPENDENCIES simplecov sinatra six - slack-notifier (~> 0.2.0) + slack-notifier (~> 0.3.2) slim spinach-rails spring (= 1.1.1) @@ -662,4 +662,4 @@ DEPENDENCIES unicorn (~> 4.6.3) unicorn-worker-killer version_sorter - webmock \ No newline at end of file + webmock diff --git a/doc/api/users.md b/doc/api/users.md index 2d5dedb3a39..2b927c30777 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -220,6 +220,18 @@ Parameters: + **none** +## List SSH keys for user + +Get a list of a specified user's SSH keys. Available only for admin + +``` +GET /users/:uid/keys +``` + +Parameters: + ++ `uid` (required) - id of specified user + ## Single SSH key @@ -286,3 +298,18 @@ Parameters: + `id` (required) - SSH key ID +## Delete SSH key + +Deletes key owned by a specified user. Available only for admin. + +``` +DELETE /users/:uid/keys/:id +``` + +Parameters: + ++ `uid` (required) - id of specified user ++ `id` (required) - SSH key ID + +Will return `200 Ok` on success, or `404 Not found` if either user or key cannot be found. + diff --git a/lib/api/users.rb b/lib/api/users.rb index ae808b6272b..6ed2740c333 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -113,6 +113,45 @@ module API end end + # Get ssh keys of a specified user. Only available to admin users. + # + # Parameters: + # uid (required) - The ID of a user + # Example Request: + # GET /users/:uid/keys + get ':uid/keys' do + authenticated_as_admin! + user = User.find_by(id: params[:uid]) + if user + present user.keys, with: Entities::SSHKey + else + not_found! + end + end + + # Delete existing ssh key of a specified user. Only available to admin + # users. + # + # Parameters: + # uid (required) - The ID of a user + # id (required) - SSH Key ID + # Example Request: + # DELETE /users/:uid/keys/:id + delete ':uid/keys/:id' do + authenticated_as_admin! + user = User.find_by(id: params[:uid]) + if user + begin + key = user.keys.find params[:id] + key.destroy + rescue ActiveRecord::RecordNotFound + not_found! + end + else + not_found! + end + end + # Delete user. Available only for admin # # Example Request: diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index 86610c47513..a6d300b099b 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -242,6 +242,67 @@ describe API::API, api: true do end end + describe 'GET /user/:uid/keys' do + before { admin } + + context 'when unauthenticated' do + it 'should return authentication error' do + get api("/users/#{user.id}/keys") + response.status.should == 401 + end + end + + context 'when authenticated' do + it 'should return 404 for non-existing user' do + get api('/users/999999/keys', admin) + response.status.should == 404 + end + + it 'should return array of ssh keys' do + user.keys << key + user.save + get api("/users/#{user.id}/keys", admin) + response.status.should == 200 + json_response.should be_an Array + json_response.first['title'].should == key.title + end + end + end + + describe 'DELETE /user/:uid/keys/:id' do + before { admin } + + context 'when unauthenticated' do + it 'should return authentication error' do + delete api("/users/#{user.id}/keys/42") + response.status.should == 401 + end + end + + context 'when authenticated' do + it 'should delete existing key' do + user.keys << key + user.save + expect { + delete api("/users/#{user.id}/keys/#{key.id}", admin) + }.to change { user.keys.count }.by(-1) + response.status.should == 200 + end + + it 'should return 404 error if user not found' do + user.keys << key + user.save + delete api("/users/999999/keys/#{key.id}", admin) + response.status.should == 404 + end + + it 'should return 404 error if key not foud' do + delete api("/users/#{user.id}/keys/42", admin) + response.status.should == 404 + end + end + end + describe "DELETE /users/:id" do before { admin } -- GitLab From b5a73b1f902c97c3289df159b1007eb4a0db9eac Mon Sep 17 00:00:00 2001 From: Marcus Ilgner Date: Fri, 18 Apr 2014 17:55:06 +0200 Subject: [PATCH 018/237] Expose archive status of projects in API That way clients like Gitlab CI can decide to show or hide projects based on that information --- lib/api/entities.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/api/entities.rb b/lib/api/entities.rb index abe6fceff14..c1bd6d02c68 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -43,6 +43,7 @@ module API class Project < Grape::Entity expose :id, :description, :default_branch expose :public?, as: :public + expose :archived?, as: :archived expose :visibility_level, :ssh_url_to_repo, :http_url_to_repo, :web_url expose :owner, using: Entities::UserBasic, unless: ->(project, options) { project.group } expose :name, :name_with_namespace -- GitLab From db86fe47ce42f8f5aa72cc52d07c7e6eb312dcf9 Mon Sep 17 00:00:00 2001 From: Dmitri Moore Date: Fri, 18 Apr 2014 20:13:53 -0700 Subject: [PATCH 019/237] Add ability to set different ssh host, if different from http/https --- config/gitlab.yml.example | 5 +++++ config/initializers/1_settings.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 64fc02fe8c2..19805aaae42 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -19,6 +19,11 @@ production: &base port: 80 https: false + # Uncommment this line below if your ssh host is different from HTTP/HTTPS one + # (you'd obviously need to replace ssh.host_example.com with your own host). + # Otherwise, ssh host will be set to the `host:` value above + # ssh_host: ssh.host_example.com + # Uncomment and customize the last line to run in a non-root path # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. # Note that four settings need to be changed for this to work. diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 59564d9ea33..82a08241e01 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -117,7 +117,7 @@ Settings.gitlab_shell['hooks_path'] ||= Settings.gitlab['user_home'] + '/gitla Settings.gitlab_shell['receive_pack'] = true if Settings.gitlab_shell['receive_pack'].nil? Settings.gitlab_shell['upload_pack'] = true if Settings.gitlab_shell['upload_pack'].nil? Settings.gitlab_shell['repos_path'] ||= Settings.gitlab['user_home'] + '/repositories/' -Settings.gitlab_shell['ssh_host'] ||= (Settings.gitlab.host || 'localhost') +Settings.gitlab_shell['ssh_host'] ||= (Settings.gitlab.ssh_host || Settings.gitlab.host || 'localhost') Settings.gitlab_shell['ssh_port'] ||= 22 Settings.gitlab_shell['ssh_user'] ||= Settings.gitlab.user Settings.gitlab_shell['owner_group'] ||= Settings.gitlab.user -- GitLab From 61e68634033219cb9620ef11078bc90254f1b553 Mon Sep 17 00:00:00 2001 From: Marcus Ilgner Date: Sun, 20 Apr 2014 12:01:55 +0200 Subject: [PATCH 020/237] Add info about exposed Project::archived to API docs --- doc/api/projects.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/api/projects.md b/doc/api/projects.md index 40bcc6e2cd4..ffaba0af7fe 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -43,7 +43,8 @@ GET /projects "owner_id": 1, "path": "diaspora", "updated_at": "2013-09-30T13: 46: 02Z" - } + }, + "archived": false }, { "id": 6, @@ -78,7 +79,8 @@ GET /projects "owner_id": 1, "path": "brightbox", "updated_at": "2013-09-30T13:46:02Z" - } + }, + "archived": false } ] ``` @@ -157,7 +159,8 @@ Parameters: "access_level": 50, "notification_level": 3 } - } + }, + "archived": false } ``` -- GitLab From e365cd84526bb84732ffdfc86060019f5c184030 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Wed, 16 Apr 2014 16:36:45 +0200 Subject: [PATCH 021/237] Add markdown styleguide. --- CONTRIBUTING.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 290804e6187..780db547f82 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -107,9 +107,10 @@ For examples of feedback on merge requests please look at already [closed merge ## Style guides 1. [Ruby](https://github.com/bbatsov/ruby-style-guide) -2. [Rails](https://github.com/bbatsov/rails-style-guide) -3. [Formatting](https://github.com/thoughtbot/guides/tree/master/style#formatting) -4. [Naming](https://github.com/thoughtbot/guides/tree/master/style#naming) -8. [Testing](https://github.com/thoughtbot/guides/tree/master/style#testing) -7. [CoffeeScript](https://github.com/thoughtbot/guides/tree/master/style#coffeescript) -9. [Shell commands](doc/development/shell_commands.md) +1. [Rails](https://github.com/bbatsov/rails-style-guide) +1. [Formatting](https://github.com/thoughtbot/guides/tree/master/style#formatting) +1. [Naming](https://github.com/thoughtbot/guides/tree/master/style#naming) +1. [Testing](https://github.com/thoughtbot/guides/tree/master/style#testing) +1. [CoffeeScript](https://github.com/thoughtbot/guides/tree/master/style#coffeescript) +1. [Shell commands](doc/development/shell_commands.md) +1. [Markdown](http://www.cirosantilli.com/markdown-styleguide) -- GitLab From e9d4587ff11c8510f01dfa184414f73d75b4550b Mon Sep 17 00:00:00 2001 From: Travis Odom Date: Mon, 21 Apr 2014 15:48:42 +0000 Subject: [PATCH 022/237] Actually use the 'user_filter' configuration option --- config/initializers/devise.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 50669ece7a8..d5cb110e881 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -223,6 +223,7 @@ Devise.setup do |config| method: Gitlab.config.ldap['method'], bind_dn: Gitlab.config.ldap['bind_dn'], password: Gitlab.config.ldap['password'], + filter: Gitlab.config.ldap['user_filter'], name_proc: email_stripping_proc end @@ -244,4 +245,4 @@ Devise.setup do |config| config.omniauth provider['name'].to_sym, *provider_arguments end -end +end \ No newline at end of file -- GitLab From 03b56b9446f851a621480e697e33328d51e75751 Mon Sep 17 00:00:00 2001 From: Terry Wang Date: Tue, 22 Apr 2014 14:22:55 +1000 Subject: [PATCH 023/237] Break the one liner & add markdown syntax highlighting for Bash --- doc/update/upgrader.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/update/upgrader.md b/doc/update/upgrader.md index fd45154ac82..72a94f67b3c 100644 --- a/doc/update/upgrader.md +++ b/doc/update/upgrader.md @@ -46,4 +46,8 @@ If all items are green, then congratulations upgrade is complete! You've read through the entire guide, and probably did all the steps manually. Here is a one liner for convenience, the next time you upgrade: - cd /home/git/gitlab; sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; sudo service gitlab stop; sudo -u git -H ruby script/upgrade.rb -y; sudo service gitlab start; sudo service nginx restart; sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production +```bash +cd /home/git/gitlab; sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; \ + sudo service gitlab stop; sudo -u git -H ruby script/upgrade.rb -y; sudo service gitlab start; \ + sudo service nginx restart; sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production +``` -- GitLab From 2a944b1d9f7a20899363e5cd90cacc83dec0954f Mon Sep 17 00:00:00 2001 From: Hidde Boomsma Date: Tue, 22 Apr 2014 15:35:09 +0200 Subject: [PATCH 024/237] added target_project_id to merge_requests.md Added description about optional field target_project_id for merge requests. --- doc/api/merge_requests.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 4e864ae1078..2996f609d43 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -105,10 +105,11 @@ POST /projects/:id/merge_requests Parameters: + `id` (required) - The ID of a project -+ `source_branch` (required) - The source branch -+ `target_branch` (required) - The target branch -+ `assignee_id` (optional) - Assignee user ID -+ `title` (required) - Title of MR ++ `source_branch` (required) - The source branch ++ `target_branch` (required) - The target branch ++ `assignee_id` (optional) - Assignee user ID ++ `title` (required) - Title of MR ++ `target_project_id` (optional) - The target project (numeric id) ```json { -- GitLab From 5a521e56cbdb4fe12af3648dccec9a25938b7c37 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Tue, 22 Apr 2014 18:21:32 +0300 Subject: [PATCH 025/237] Newline between sentence and code block --- doc/integration/omniauth.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/integration/omniauth.md b/doc/integration/omniauth.md index a4491432caf..84a5a8e8c28 100644 --- a/doc/integration/omniauth.md +++ b/doc/integration/omniauth.md @@ -21,6 +21,7 @@ Before configuring individual OmniAuth providers there are a few global settings ``` 2. Find the section dealing with OmniAuth. The section will look similar to the following.
+ ``` ## OmniAuth settings omniauth: @@ -50,6 +51,7 @@ Before configuring individual OmniAuth providers there are a few global settings # app_secret: 'YOUR APP SECRET', # args: { scope: 'user:email' } } ``` + 3. Change `enabled` to `true`. 4. Consider the next two configuration options: `allow_single_sign_on` and `block_auto_created_users`. * `allow_single_sign_on` defaults to `false`. If `false` users must be created manually or they will not be able to -- GitLab From 4134b38a8487bf28ac0a79f073e8136eabf7708c Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Tue, 22 Apr 2014 17:06:16 -0500 Subject: [PATCH 026/237] Fix syntax highlighting Don't break highlighting on multi-line spans (multi-line comments for example) --- app/assets/javascripts/dispatcher.js.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index 46d6db0f05c..b61d9875e03 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -59,7 +59,7 @@ class Dispatcher initHighlight: -> $('.highlight pre code').each (i, e) -> - hljs.highlightBlock(e) $(e).html($.map($(e).html().split("\n"), (line, i) -> - "
" + line + "
" + "" + line + "" ).join("\n")) + hljs.highlightBlock(e) -- GitLab From baec3f9bd76f4780e66b1055433948427e30cc6d Mon Sep 17 00:00:00 2001 From: Philzen Date: Wed, 23 Apr 2014 08:57:54 +0200 Subject: [PATCH 027/237] # Fix description Typo --- config/gitlab.yml.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 64fc02fe8c2..f60e34fcb7b 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -102,7 +102,7 @@ production: &base # ## :id - Issue id (from commit messages) # issues_url: "http://redmine.sample/issues/:id" # - # ## If not nil, linkis to creating new issues will be replaced with this + # ## If not nil, links to creating new issues will be replaced with this # ## Use placeholders: # ## :project_id - GitLab project identifier # ## :issues_tracker_id - Project Name or Id in external issue tracker -- GitLab From 43e77099d86960401013a45f56e29bfb83368d2c Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 15 Apr 2014 16:26:15 +0200 Subject: [PATCH 028/237] Adjust MySQL limits for existing installations --- CHANGELOG | 1 + db/migrate/20140415124820_limits_to_mysql.rb | 1 + db/migrate/limits_to_mysql.rb | 10 ++++++++++ lib/tasks/migrate/add_limits_mysql.rake | 11 ++--------- 4 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 db/migrate/20140415124820_limits_to_mysql.rb create mode 100644 db/migrate/limits_to_mysql.rb diff --git a/CHANGELOG b/CHANGELOG index 25067d3abe2..7c177b3139a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,7 @@ v 6.8.0 - Expose event and mergerequest timestamps in API - Fix emails on push service when only one commit is pushed - Store Rails cache data in the Redis `cache:gitlab` namespace + - Adjust MySQL limits for existing installations v 6.7.3 - Fix the merge notification email not being sent (Pierre de La Morinerie) diff --git a/db/migrate/20140415124820_limits_to_mysql.rb b/db/migrate/20140415124820_limits_to_mysql.rb new file mode 100644 index 00000000000..3f6e62617c5 --- /dev/null +++ b/db/migrate/20140415124820_limits_to_mysql.rb @@ -0,0 +1 @@ +require_relative 'limits_to_mysql' diff --git a/db/migrate/limits_to_mysql.rb b/db/migrate/limits_to_mysql.rb new file mode 100644 index 00000000000..4dc3b830bc6 --- /dev/null +++ b/db/migrate/limits_to_mysql.rb @@ -0,0 +1,10 @@ +class LimitsToMysql < ActiveRecord::Migration + def up + return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] == 'mysql2' + + change_column :merge_request_diffs, :st_commits, :text, limit: 2147483647 + change_column :merge_request_diffs, :st_diffs, :text, limit: 2147483647 + change_column :snippets, :content, :text, limit: 2147483647 + change_column :notes, :st_diff, :text, limit: 2147483647 + end +end diff --git a/lib/tasks/migrate/add_limits_mysql.rake b/lib/tasks/migrate/add_limits_mysql.rake index 46b6451752b..a1972a682d8 100644 --- a/lib/tasks/migrate/add_limits_mysql.rake +++ b/lib/tasks/migrate/add_limits_mysql.rake @@ -1,14 +1,7 @@ +require Rails.root.join('db/migrate/limits_to_mysql') + desc "GITLAB | Add limits to strings in mysql database" task add_limits_mysql: :environment do puts "Adding limits to schema.rb for mysql" LimitsToMysql.new.up end - -class LimitsToMysql < ActiveRecord::Migration - def up - change_column :merge_request_diffs, :st_commits, :text, limit: 2147483647 - change_column :merge_request_diffs, :st_diffs, :text, limit: 2147483647 - change_column :snippets, :content, :text, limit: 2147483647 - change_column :notes, :st_diff, :text, limit: 2147483647 - end -end -- GitLab From cd61239540c00279563cc0e4ae763a569be0bef5 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 16 Apr 2014 11:26:02 +0200 Subject: [PATCH 029/237] Move the adapter check to the migration --- db/migrate/limits_to_mysql.rb | 2 +- lib/tasks/gitlab/setup.rake | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/db/migrate/limits_to_mysql.rb b/db/migrate/limits_to_mysql.rb index 4dc3b830bc6..2b7afae6d7c 100644 --- a/db/migrate/limits_to_mysql.rb +++ b/db/migrate/limits_to_mysql.rb @@ -1,6 +1,6 @@ class LimitsToMysql < ActiveRecord::Migration def up - return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] == 'mysql2' + return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/ change_column :merge_request_diffs, :st_commits, :text, limit: 2147483647 change_column :merge_request_diffs, :st_diffs, :text, limit: 2147483647 diff --git a/lib/tasks/gitlab/setup.rake b/lib/tasks/gitlab/setup.rake index 853994dd67d..8b4ccdfc3fe 100644 --- a/lib/tasks/gitlab/setup.rake +++ b/lib/tasks/gitlab/setup.rake @@ -15,14 +15,7 @@ namespace :gitlab do end Rake::Task["db:setup"].invoke - - config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env] - success = case config["adapter"] - when /^mysql/ then - Rake::Task["add_limits_mysql"].invoke - when "postgresql" then - end - + Rake::Task["add_limits_mysql"].invoke Rake::Task["db:seed_fu"].invoke rescue Gitlab::TaskAbortedByUserError puts "Quitting...".red -- GitLab From acebfdc7b12a849bef055fa53d0f278318bdad72 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 23 Apr 2014 11:09:38 +0200 Subject: [PATCH 030/237] Move changelog entries to 6.9.0 --- CHANGELOG | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7c177b3139a..5137c87a5f3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +v 6.9.0 + - Store Rails cache data in the Redis `cache:gitlab` namespace + - Adjust MySQL limits for existing installations + v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion - Enabled GZip Compression for assets in example Nginx, make sure that Nginx is compiled with --with-http_gzip_static_module flag (this is default in Ubuntu) @@ -17,8 +21,6 @@ v 6.8.0 - Fix download link for huge MR diffs - Expose event and mergerequest timestamps in API - Fix emails on push service when only one commit is pushed - - Store Rails cache data in the Redis `cache:gitlab` namespace - - Adjust MySQL limits for existing installations v 6.7.3 - Fix the merge notification email not being sent (Pierre de La Morinerie) -- GitLab From 77e565d347b2b7b56769977dacc4eb1d4a741ed3 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 23 Apr 2014 11:13:21 +0200 Subject: [PATCH 031/237] Bump the required gitlab-shell version to 1.9.3 --- lib/tasks/gitlab/check.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index e9258cc626b..bf015a1fe16 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -779,7 +779,7 @@ namespace :gitlab do end def check_gitlab_shell - required_version = Gitlab::VersionInfo.new(1, 9, 1) + required_version = Gitlab::VersionInfo.new(1, 9, 3) current_version = Gitlab::VersionInfo.parse(gitlab_shell_version) print "GitLab Shell version >= #{required_version} ? ... " -- GitLab From 7c5b61224a040ed6489633ab5efd033c26bd2469 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 23 Apr 2014 15:50:05 +0200 Subject: [PATCH 032/237] We are at 6.9.0.pre. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index e029aa99b7d..c0ad52beda3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.8.0 +6.9.0.pre -- GitLab From 2134e18ec64222e60aa0d8947a5d9e265c6e4975 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 23 Apr 2014 16:19:59 +0200 Subject: [PATCH 033/237] Fix default ssh_host setting --- config/initializers/1_settings.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index ee1b7ebf3f3..c4e1c352e5e 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -73,6 +73,7 @@ Settings.gitlab['default_projects_limit'] ||= 10 Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil? Settings.gitlab['default_theme'] = Gitlab::Theme::MARS if Settings.gitlab['default_theme'].nil? Settings.gitlab['host'] ||= 'localhost' +Settings.gitlab['ssh_host'] ||= 'localhost' Settings.gitlab['https'] = false if Settings.gitlab['https'].nil? Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || '' -- GitLab From e54b457ea31eff54d031b7092a2a78dc81c69a63 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 23 Apr 2014 16:22:49 +0200 Subject: [PATCH 034/237] Improve ssh_host settings --- config/initializers/1_settings.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index c4e1c352e5e..97f29546404 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -73,7 +73,7 @@ Settings.gitlab['default_projects_limit'] ||= 10 Settings.gitlab['default_can_create_group'] = true if Settings.gitlab['default_can_create_group'].nil? Settings.gitlab['default_theme'] = Gitlab::Theme::MARS if Settings.gitlab['default_theme'].nil? Settings.gitlab['host'] ||= 'localhost' -Settings.gitlab['ssh_host'] ||= 'localhost' +Settings.gitlab['ssh_host'] ||= Settings.gitlab.host Settings.gitlab['https'] = false if Settings.gitlab['https'].nil? Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 Settings.gitlab['relative_url_root'] ||= ENV['RAILS_RELATIVE_URL_ROOT'] || '' @@ -118,7 +118,7 @@ Settings.gitlab_shell['hooks_path'] ||= Settings.gitlab['user_home'] + '/gitla Settings.gitlab_shell['receive_pack'] = true if Settings.gitlab_shell['receive_pack'].nil? Settings.gitlab_shell['upload_pack'] = true if Settings.gitlab_shell['upload_pack'].nil? Settings.gitlab_shell['repos_path'] ||= Settings.gitlab['user_home'] + '/repositories/' -Settings.gitlab_shell['ssh_host'] ||= (Settings.gitlab.ssh_host || Settings.gitlab.host || 'localhost') +Settings.gitlab_shell['ssh_host'] ||= Settings.gitlab.ssh_host Settings.gitlab_shell['ssh_port'] ||= 22 Settings.gitlab_shell['ssh_user'] ||= Settings.gitlab.user Settings.gitlab_shell['owner_group'] ||= Settings.gitlab.user -- GitLab From 7dd0860e5a9d0a1758732742999190890ac33d48 Mon Sep 17 00:00:00 2001 From: Chenguang Zhang Date: Wed, 23 Apr 2014 15:01:43 +0800 Subject: [PATCH 035/237] Remove fixed height for diff table --- app/assets/stylesheets/sections/diff.scss | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/assets/stylesheets/sections/diff.scss b/app/assets/stylesheets/sections/diff.scss index eb272f20f40..fe285f94bdd 100644 --- a/app/assets/stylesheets/sections/diff.scss +++ b/app/assets/stylesheets/sections/diff.scss @@ -70,18 +70,15 @@ .diff-side { overflow-x: scroll; width: 508px; - height: 700px; } .diff-side.diff-side-left{ overflow-y:hidden; } .diff-side table, td.diff-middle table { - height: 700px; } .diff-middle { width: 114px; vertical-align: top; - height: 700px; overflow: hidden } -- GitLab From d1648a6a2150c26c12a4f108040676a49627b8a0 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Wed, 23 Apr 2014 21:58:58 +0300 Subject: [PATCH 036/237] Ensure git user can create the database. Fix #175 --- doc/install/installation.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index 579656eda2f..5924033c95e 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -145,6 +145,7 @@ GitLab Shell is an ssh access and repository management software developed speci # 5. Database We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](database_mysql.md). +NOTE: because we need to make use of extensions you need at least pgsql 9.1. # Install the database packages sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev @@ -153,7 +154,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da sudo -u postgres psql -d template1 # Create a user for GitLab. - template1=# CREATE USER git; + template1=# CREATE USER git CREATEDB; # Create the GitLab production database & grant all privileges on database template1=# CREATE DATABASE gitlabhq_production OWNER git; -- GitLab From a4bf8037fbd18a27d83a8ee1943978ad241257ce Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Wed, 23 Apr 2014 21:00:26 +0200 Subject: [PATCH 037/237] Multiple grammar/typo fixes in web hooks help --- doc/web_hooks/web_hooks.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index f80891e264d..5ad0c8a138f 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -2,16 +2,16 @@ Project web hooks allow you to trigger an URL if new code is pushed or a new iss --- -You can configure web hook to listen for specific events like pushes, issues, merge requests. -GitLab will send POST request with data to web hook URL. -Web Hooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server. +You can configure web hooks to listen for specific events like pushes, issues or merge requests. +GitLab will send a POST request with data to the web hook URL. +Web hooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server. If you send a web hook to an SSL endpoint [the certificate will not be verified](https://gitlab.com/gitlab-org/gitlab-ce/blob/ccd617e58ea71c42b6b073e692447d0fe3c00be6/app/models/web_hook.rb#L35) since many people use self-signed certificates. --- #### Push events -Triggered when you push to the repository except pushing tags. +Triggered when you push to the repository except when pushing tags. **Request body:** @@ -84,7 +84,7 @@ Triggered when a new issue is created or an existing issue was updated/closed/re #### Merge request events -Triggered when a new merge request is created or an existing merge request was updated/merges/closed. +Triggered when a new merge request is created or an existing merge request was updated/merged/closed. **Request body:** -- GitLab From de794b6a77dba50a76e79538797ce2873c1e8700 Mon Sep 17 00:00:00 2001 From: Ben Bytheway Date: Wed, 23 Apr 2014 21:00:56 -0600 Subject: [PATCH 038/237] Add scoping to ldap lookup when only dn given --- lib/gitlab/ldap/adapter.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/ldap/adapter.rb b/lib/gitlab/ldap/adapter.rb index 983a2956a35..0777558d643 100644 --- a/lib/gitlab/ldap/adapter.rb +++ b/lib/gitlab/ldap/adapter.rb @@ -44,7 +44,8 @@ module Gitlab def users(field, value) if field.to_sym == :dn options = { - base: value + base: value, + scope: Net::LDAP::SearchScope_BaseObject } else options = { -- GitLab From fe1ca616017633a243017ad265c4713aca773ea3 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 24 Apr 2014 13:23:17 +0200 Subject: [PATCH 039/237] Make sure that tests pass when aws group is used. --- Gemfile | 3 ++- Gemfile.lock | 4 ++++ config/initializers/carrierwave.rb | 12 ++++++++++++ spec/helpers/application_helper_spec.rb | 4 ++-- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 4ab1ab50eb9..7372d244725 100644 --- a/Gemfile +++ b/Gemfile @@ -71,6 +71,7 @@ gem "carrierwave" # for aws storage gem "fog", "~> 1.14", group: :aws +gem "unf", group: :aws # Authorization gem "six" @@ -232,4 +233,4 @@ end group :production do gem "gitlab_meta", '6.0' -end \ No newline at end of file +end diff --git a/Gemfile.lock b/Gemfile.lock index 155e03e5456..0556b870be5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -531,6 +531,9 @@ GEM execjs (>= 0.3.0) json (>= 1.8.0) underscore-rails (1.4.4) + unf (0.1.4) + unf_ext + unf_ext (0.0.6) unicorn (4.6.3) kgio (~> 2.6) rack @@ -659,6 +662,7 @@ DEPENDENCIES turbolinks uglifier underscore-rails (~> 1.4.4) + unf unicorn (~> 4.6.3) unicorn-worker-killer version_sorter diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index 6875fa74edd..d0065b63e54 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -18,4 +18,16 @@ if File.exists?(aws_file) config.fog_authenticated_url_expiration = 1 << 29 # optional time (in seconds) that authenticated urls will be valid. # when fog_public is false and provider is AWS or Google, defaults to 600 end + + # Mocking Fog requests, based on: https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Test-Fog-based-uploaders + if Rails.env.test? + Fog.mock! + connection = ::Fog::Storage.new( + :aws_access_key_id => AWS_CONFIG['access_key_id'], + :aws_secret_access_key => AWS_CONFIG['secret_access_key'], + :provider => 'AWS', + :region => AWS_CONFIG['region'] + ) + connection.directories.create(:key => AWS_CONFIG['bucket']) + end end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 61c561335e5..0376e0aadf0 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -46,7 +46,7 @@ describe ApplicationHelper do group = create(:group) group.avatar = File.open(avatar_file_path) group.save! - group_icon(group.path).to_s.should == "/uploads/group/avatar/#{ group.id }/gitlab_logo.png" + group_icon(group.path).to_s.should match("/uploads/group/avatar/#{ group.id }/gitlab_logo.png") end it "should give default avatar_icon when no avatar is present" do @@ -63,7 +63,7 @@ describe ApplicationHelper do user = create(:user) user.avatar = File.open(avatar_file_path) user.save! - avatar_icon(user.email).to_s.should == "/uploads/user/avatar/#{ user.id }/gitlab_logo.png" + avatar_icon(user.email).to_s.should match("/uploads/user/avatar/#{ user.id }/gitlab_logo.png") end it "should call gravatar_icon when no avatar is present" do -- GitLab From 0050c07fdda59f36ca2959e08d422ff5d6479e10 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 24 Apr 2014 15:00:18 +0200 Subject: [PATCH 040/237] Serve a file if in wiki. --- app/controllers/projects/wikis_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index bcd9e0d5219..0eb9364eaa4 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -15,6 +15,17 @@ class Projects::WikisController < Projects::ApplicationController if @page render 'show' + elsif file = @project_wiki.wiki.file(params[:id], @project_wiki.wiki.ref, true) + if file.on_disk? + send_file file.on_disk_path, :disposition => 'inline' + else + send_data( + file.raw_data, + type: file.mime_type, + disposition: 'inline', + filename: file.name + ) + end else return render('empty') unless can?(current_user, :write_wiki, @project) @page = WikiPage.new(@project_wiki) -- GitLab From 84870438f95092957c2ad5ca4581e2b95f98033d Mon Sep 17 00:00:00 2001 From: Chenguang Zhang Date: Thu, 24 Apr 2014 16:49:01 +0800 Subject: [PATCH 041/237] Add support for side-by-side inline comments --- app/assets/stylesheets/sections/diff.scss | 25 ++---- app/assets/stylesheets/sections/notes.scss | 1 + .../projects/commits/_parallel_view.html.haml | 83 ++++++++----------- .../_diff_notes_with_reply_parallel.html.haml | 21 +++-- 4 files changed, 52 insertions(+), 78 deletions(-) diff --git a/app/assets/stylesheets/sections/diff.scss b/app/assets/stylesheets/sections/diff.scss index fe285f94bdd..64e669ac2b3 100644 --- a/app/assets/stylesheets/sections/diff.scss +++ b/app/assets/stylesheets/sections/diff.scss @@ -63,23 +63,14 @@ } } - .text-file-parallel div { - display: inline-block; - padding-bottom: 16px; - } - .diff-side { - overflow-x: scroll; - width: 508px; - } - .diff-side.diff-side-left{ - overflow-y:hidden; - } - .diff-side table, td.diff-middle table { - } - .diff-middle { - width: 114px; - vertical-align: top; - overflow: hidden + tr.line_holder.parallel{ + .old_line, .new_line, .diff_line { + min-width: 50px; + } + + td.line_content.parallel{ + width: 50%; + } } .old_line, .new_line, .diff_line { diff --git a/app/assets/stylesheets/sections/notes.scss b/app/assets/stylesheets/sections/notes.scss index c9c7b6ecced..7e56781f56a 100644 --- a/app/assets/stylesheets/sections/notes.scss +++ b/app/assets/stylesheets/sections/notes.scss @@ -139,6 +139,7 @@ ul.notes { background-color: #fff; border-width: 1px 0; padding-top: 0; + vertical-align: top; li { padding: 5px; diff --git a/app/views/projects/commits/_parallel_view.html.haml b/app/views/projects/commits/_parallel_view.html.haml index 5b60ab80ba4..80f5be98f2f 100644 --- a/app/views/projects/commits/_parallel_view.html.haml +++ b/app/views/projects/commits/_parallel_view.html.haml @@ -2,54 +2,37 @@ - old_lines, new_lines = parallel_diff_lines(project, @commit, diff, file) - num_lines = old_lines.length -%div.text-file-parallel - %div.diff-side.diff-side-left - %table - - old_lines.each do |line| +%div.text-file + %table + - num_lines.times do |index| + - new_line = new_lines[index] + - old_line = old_lines[index] + %tr.line_holder.parallel + -# For old line + - if old_line.type == :file_created + %td.old_line= old_line.num + %td.line_content.parallel= "File was created" + - elsif old_line.type == :deleted + %td.old_line.old= old_line.num + %td.line_content{class: "parallel noteable_line old #{old_line.code}", "line_code" => old_line.code}= old_line.content + - else old_line.type == :no_change + %td.old_line= old_line.num + %td.line_content.parallel= old_line.content + + -# For new line + - if new_line.type == :file_deleted + %td.new_line= new_line.num + %td.line_content.parallel= "File was deleted" + - elsif new_line.type == :added + %td.new_line.new= new_line.num + %td.line_content{class: "parallel noteable_line new #{new_line.code}", "line_code" => new_line.code}= new_line.content + - else new_line.type == :no_change + %td.new_line= new_line.num + %td.line_content.parallel= new_line.content + + - if @reply_allowed + - comments1 = @line_notes.select { |n| n.line_code == old_line.code }.sort_by(&:created_at) + - comments2 = @line_notes.select { |n| n.line_code == new_line.code }.sort_by(&:created_at) + - unless comments1.empty? and comments2.empty? + = render "projects/notes/diff_notes_with_reply_parallel", notes1: comments1, notes2: comments2 - %tr.line_holder.parallel - - if line.type == :file_created - %td.line_content.parallel= "File was created" - - elsif line.type == :deleted - %td.line_content{class: "parallel noteable_line old #{line.code}", "line_code" => line.code }= line.content - - else line.type == :no_change - %td.line_content.parallel= line.content - - %div.diff-middle - %table - - num_lines.times do |index| - %tr - - if old_lines[index].type == :deleted - %td.old_line.old= old_lines[index].num - - else - %td.old_line= old_lines[index].num - - %td.diff_line="" - - - if new_lines[index].type == :added - %td.new_line.new= new_lines[index].num - - else - %td.new_line= new_lines[index].num - - %div.diff-side.diff-side-right - %table - - new_lines.each do |line| - - %tr.line_holder.parallel - - if line.type == :file_deleted - %td.line_content.parallel= "File was deleted" - - elsif line.type == :added - %td.line_content{class: "parallel noteable_line new #{line.code}", "line_code" => line.code }= line.content - - else line.type == :no_change - %td.line_content.parallel= line.content - -:javascript - $('.diff-side-right').on('scroll', function(){ - $('.diff-side-left, .diff-middle').scrollTop($(this).scrollTop()); - $('.diff-side-left').scrollLeft($(this).scrollLeft()); - }); - - $('.diff-side-left').on('scroll', function(){ - $('.diff-side-right, .diff-middle').scrollTop($(this).scrollTop()); // might never be relevant - $('.diff-side-right').scrollLeft($(this).scrollLeft()); - }); diff --git a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml index 2012aa021b9..399ce30d1a9 100644 --- a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml +++ b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml @@ -1,34 +1,33 @@ - note1 = notes1.first # example note - note2 = notes2.first # example note +-# Check if line want not changed since comment was left +/- if !defined?(line) || line == note.diff_line %tr.notes_holder.js-toggle-content - -# Check if line want not changed since comment was left - /- if !defined?(line1) || line1 == note1.diff_line - if note1 + %td.notes_line + %span.btn.disabled + %i.icon-comment + = notes1.count %td.notes_content %ul.notes{ rel: note1.discussion_id } = render notes1 + = render "projects/notes/discussion_reply_button", note: note1 - %td.notes_line2 - %span.btn.disabled.parallel-comment - %i.icon-comment - = notes1.count - else %td= "" %td= "" - %td= "" - - -# Check if line want not changed since comment was left - /- if !defined?(line2) || line2 == note2.diff_line - if note2 %td.notes_line - %span.btn.disabled.parallel-comment + %span.btn.disabled %i.icon-comment = notes2.count %td.notes_content %ul.notes{ rel: note2.discussion_id } = render notes2 + = render "projects/notes/discussion_reply_button", note: note2 - else %td= "" %td= "" + -- GitLab From edc32047dc7f02783134495ce094a29297cca243 Mon Sep 17 00:00:00 2001 From: Job van der Voort Date: Thu, 24 Apr 2014 17:17:23 +0200 Subject: [PATCH 042/237] start to make the monthly release doc a step by step guide --- doc/release/monthly.md | 117 ++++++++++++++++++++++++++++------------- 1 file changed, 81 insertions(+), 36 deletions(-) diff --git a/doc/release/monthly.md b/doc/release/monthly.md index 284e4e16595..d57934891df 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -1,15 +1,51 @@ -# Things to do when creating new monthly minor or major release +# Monthly Release NOTE: This is a guide for GitLab developers. If you are trying to install GitLab see the latest stable [installation guide](install/installation.md) and if you are trying to upgrade, see the [upgrade guides](update). -## Install guide up to date? +# Release Schedule -* References correct GitLab branch `x-x-stable` and correct GitLab shell tag? +After making the release branch new commits are cherry-picked from master. When the release gets closer we get more selective what is cherry-picked. The days of the month are approximately as follows: + +* 1-7th: Official merge window (see contributing guide). +* 8-14th: Work on bugfixes, sponsored features and GitLab EE. +* 15th: Code freeze +* 18th: Release Candidate 1 +* 20st: Optional release candidate 2 +* 22nd: Release +* 23nd: Optional patch releases +* 24-end of month: Release GitLab EE and GitLab CI + +# 15th - Code Freeze & Release Manager + +- Stop merging in code, except for important bugfixes + +## Release Manager + +A release manager is selected that coordinates the entire release of this version. The release manager has to make sure all the steps below are done and delegated where necessary. This person should also make sure this document is kept up to date and issues are created and updated. + +# 18th - Releasing RC1 + +> Yo dawg, I heard you like releases.. + +The RC1 release comes with the task to update the installation and upgrade docs. Be mindful that there might already be merge requests for this on GitLab or GitHub. + +### 1. Create an issue for RC1 release + +### 2. Update the installation guide + +1. Check if it references the correct branch `x-x-stable` (doesn't exist yet, but that is okay) +2. Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) +3. Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) +4. There might be other changes. Ask around. -## Make upgrade guide +### 3. Create an update guide -### From x.x to x.x +It's best to copy paste the previous guide and make changes where necessary. The typical steps are listed below with any points you should specifically look at. -#### 0. Any major changes? Database updates? Web server change? File structure changes? +#### 0. Any major changes? +List any major changes here, so the user is aware of them before starting to upgrade. For instance: +- Database updates +- Web server changes +- File structure changes #### 1. Make backup @@ -17,9 +53,9 @@ NOTE: This is a guide for GitLab developers. If you are trying to install GitLab #### 3. Do users need to update dependencies like `git`? -- Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) +- Check if the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) changed since the last release. -- Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) +- Check if the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) changed since the last release. #### 4. Get latest code @@ -29,7 +65,7 @@ NOTE: This is a guide for GitLab developers. If you are trying to install GitLab #### 7. Any config files updated since last release? -Check if any of these changed since last release (~22nd of last month depending on when last release branch was created): +Check if any of these changed since last release: * https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/nginx/gitlab * https://gitlab.com/gitlab-org/gitlab-shell/commits/master/config.yml.example @@ -40,13 +76,14 @@ Check if any of these changed since last release (~22nd of last month depending #### 8. Need to update init script? -Check if changed since last release (~22nd of last month depending on when last release branch was created): https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/init.d/gitlab +Check if the init.d/gitlab script changed since last release: https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/init.d/gitlab #### 9. Start application #### 10. Check application status -## Make sure the code quality indicatiors are good +### 4. Code quality indicatiors +Make sure the code quality indicators are green / good. * [![build status](http://ci.gitlab.org/projects/1/status.png?ref=master)](http://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch) @@ -58,34 +95,42 @@ Check if changed since last release (~22nd of last month depending on when last * [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) -## Release Schedule +### 5. Set VERSION + +Set VERSION tot x.x.0.rc1 + + +### 6. Tag + +Create an annotated tag that points to the version change commit. +``` +git tag -a vx.x.0.rc1 -m 'Version x.x.0.rc1' +``` + +### 7. Tweet + +Tweet about the RC release. Make sure to explain what a RC is. + +### 8. Update Cloud + +Merge the RC1 code into Cloud. Once the build is green, deploy in the morning. + +It is important to do this as soon as possible, so we can catch any errors before we release the full version. + + +# 22nd - Release After making the release branch new commits are cherry-picked from master. When the release gets closer we get more selective what is cherry-picked. The days of the month are approximately as follows: -* 1-7th: Official merge window (see contributing guide). -* 8-14th: Work on bugfixes, sponsored features and GitLab EE. -* 15th: Code freeze - - Stop merging into master, except essential bugfixes - - Select a Release Manager -* 18th: Release Candidate 1 - - Set VERSION to x.x.0.rc1 - - Create annotated tag x.x.0.rc1 - - Push the changes to GitLab.com, dev.gitlab.com, GitHub - - Tweet about the release - - Create a new branch on cloud for rc1 - - Deploy the new branch on Cloud after tests pass -* 20st: Optional release candidate 2 (x.x.0.rc2, only if rc1 had problems) -* 22nd: Release - - Create x-x-stable branch and push to the repositories - - QA - - Fix anything coming out of the QA - - Set VERSION to x.x.0 - - Create annotated tag x.x.0 - - Push VERSION + Tag to master, merge into x-x-stable - - Publish blog for new release - - Tweet to blog (see below) -* 23nd: optional patch releases (x.x.1, x.x.2, etc., only if there are serious problems) -* 24-end of month: release GitLab EE and GitLab CI + +- Create x-x-stable branch and push to the repositories +- QA +- Fix anything coming out of the QA +- Set VERSION to x.x.0 +- Create annotated tag x.x.0 +- Push VERSION + Tag to master, merge into x-x-stable +- Publish blog for new release +- Tweet to blog (see below) # Write a blog post -- GitLab From c46a0612706a2570342178fe8f61222034675c38 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 16 Apr 2014 11:02:42 +0300 Subject: [PATCH 043/237] Add uniq db index on project_id+iid --- db/migrate/20140416074002_add_index_on_iid.rb | 7 +++++++ db/schema.rb | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 db/migrate/20140416074002_add_index_on_iid.rb diff --git a/db/migrate/20140416074002_add_index_on_iid.rb b/db/migrate/20140416074002_add_index_on_iid.rb new file mode 100644 index 00000000000..cbd09082781 --- /dev/null +++ b/db/migrate/20140416074002_add_index_on_iid.rb @@ -0,0 +1,7 @@ +class AddIndexOnIid < ActiveRecord::Migration + def change + add_index :issues, [:project_id, :iid], unique: true + add_index :merge_requests, [:target_project_id, :iid], unique: true + add_index :milestones, [:project_id, :iid], unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index e53a637af66..17ca752db78 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -93,6 +93,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do add_index "issues", ["author_id"], name: "index_issues_on_author_id", using: :btree add_index "issues", ["created_at"], name: "index_issues_on_created_at", using: :btree add_index "issues", ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree + add_index "issues", ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true, using: :btree add_index "issues", ["project_id"], name: "index_issues_on_project_id", using: :btree add_index "issues", ["title"], name: "index_issues_on_title", using: :btree @@ -143,6 +144,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree add_index "merge_requests", ["source_project_id"], name: "index_merge_requests_on_source_project_id", using: :btree add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree + add_index "merge_requests", ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid", unique: true, using: :btree add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree create_table "milestones", force: true do |t| @@ -157,6 +159,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do end add_index "milestones", ["due_date"], name: "index_milestones_on_due_date", using: :btree + add_index "milestones", ["project_id", "iid"], name: "index_milestones_on_project_id_and_iid", unique: true, using: :btree add_index "milestones", ["project_id"], name: "index_milestones_on_project_id", using: :btree create_table "namespaces", force: true do |t| -- GitLab From 3bf1cff4215c8b60c4133c3e822495f046638583 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 23 Apr 2014 16:15:50 +0200 Subject: [PATCH 044/237] Add iids changelog entry --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 5137c87a5f3..a5671948a6f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ v 6.9.0 - Store Rails cache data in the Redis `cache:gitlab` namespace - Adjust MySQL limits for existing installations + - Add db index on project_id+iid column. This prevents duplicate on iid. v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion -- GitLab From ae7bd9f7c0d78a4c039a8511d8d045eebd9706e4 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 24 Apr 2014 19:35:06 +0200 Subject: [PATCH 045/237] Migrate invalid rows with missing iids or duplicates --- app/models/milestone.rb | 1 + db/migrate/20140416074002_add_index_on_iid.rb | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/app/models/milestone.rb b/app/models/milestone.rb index 6a2ca767030..39ab0b536a3 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -25,6 +25,7 @@ class Milestone < ActiveRecord::Base scope :active, -> { with_state(:active) } scope :closed, -> { with_state(:closed) } + scope :of_projects, ->(ids) { where(project_id: ids) } validates :title, presence: true validates :project, presence: true diff --git a/db/migrate/20140416074002_add_index_on_iid.rb b/db/migrate/20140416074002_add_index_on_iid.rb index cbd09082781..85269e2a03b 100644 --- a/db/migrate/20140416074002_add_index_on_iid.rb +++ b/db/migrate/20140416074002_add_index_on_iid.rb @@ -1,7 +1,32 @@ class AddIndexOnIid < ActiveRecord::Migration def change + RemoveDuplicateIid.clean(Issue) + RemoveDuplicateIid.clean(MergeRequest, 'target_project_id') + RemoveDuplicateIid.clean(Milestone) + add_index :issues, [:project_id, :iid], unique: true add_index :merge_requests, [:target_project_id, :iid], unique: true add_index :milestones, [:project_id, :iid], unique: true end end + +class RemoveDuplicateIid + def self.clean(klass, project_field = 'project_id') + duplicates = klass.find_by_sql("SELECT iid, #{project_field} FROM #{klass.table_name} GROUP BY #{project_field}, iid HAVING COUNT(*) > 1") + + duplicates.each do |duplicate| + project_id = duplicate.send(project_field) + iid = duplicate.iid + items = klass.of_projects(project_id).where(iid: iid) + + if items.size > 1 + puts "Remove #{klass.name} duplicates for iid: #{iid} and project_id: #{project_id}" + items.shift + items.each do |item| + item.destroy + puts '.' + end + end + end + end +end -- GitLab From 2eaca5453654f4c5e773067f303d6002268cd06e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 24 Apr 2014 19:53:00 +0200 Subject: [PATCH 046/237] Add rake setup alias for gitlab:setup --- lib/tasks/setup.rake | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 lib/tasks/setup.rake diff --git a/lib/tasks/setup.rake b/lib/tasks/setup.rake new file mode 100644 index 00000000000..93701de8f63 --- /dev/null +++ b/lib/tasks/setup.rake @@ -0,0 +1,4 @@ +desc "GITLAB | Setup gitlab db" +task :setup do + Rake::Task["gitlab:setup"].invoke +end -- GitLab From 7e10d1017819ea0be41887803e9b4d6edd92bf49 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 24 Apr 2014 19:53:18 +0200 Subject: [PATCH 047/237] Add doc file for dev rake tasks --- doc/development/README.md | 7 +++++-- doc/development/rake_tasks.md | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 doc/development/rake_tasks.md diff --git a/doc/development/README.md b/doc/development/README.md index aa59eb2c3e1..eb88b6c860f 100644 --- a/doc/development/README.md +++ b/doc/development/README.md @@ -1,2 +1,5 @@ -+ [Architecture](architecture.md) -+ [Shell commands](shell_commands.md) +## Development + ++ [Architecture](architecture.md) of GitLab ++ [Shell commands](shell_commands.md) in the GitLab codebase ++ [Rake tasks](rake_tasks.md) for development diff --git a/doc/development/rake_tasks.md b/doc/development/rake_tasks.md new file mode 100644 index 00000000000..9e75b3a6275 --- /dev/null +++ b/doc/development/rake_tasks.md @@ -0,0 +1,25 @@ +# Rake tasks for developers + +## Setup db with developer seeds: + +Note that if your db user does not have advanced privilegies you must create db manually before run this command + +``` +bundle exec rake setup +``` + +## Run tests + +This runs all test suite present in GitLab + +``` +bundle exec rake test +``` + +## Generate searchable docs for source code + +You can find results under `doc/code` directory + +``` +bundle exec rake gitlab:generate_docs +``` -- GitLab From ccdf7a329a3eb483a6ec2f9c68d77f5697844f0d Mon Sep 17 00:00:00 2001 From: Adam Engebretson Date: Fri, 25 Apr 2014 03:38:54 +0000 Subject: [PATCH 048/237] Added Laravel API Wrapper --- doc/api/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/README.md b/doc/api/README.md index b1740f35792..5f848e0f4b7 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -21,6 +21,7 @@ ## Clients + [php-gitlab-api](https://github.com/m4tthumphrey/php-gitlab-api) - PHP ++ [Laravel API Wrapper for GitLab CE](https://github.com/adamgoose/gitlab) - PHP / [Laravel](http://laravel.com) + [Ruby Wrapper](https://github.com/NARKOZ/gitlab) - Ruby + [python-gitlab](https://github.com/Itxaka/python-gitlab) - Python + [java-gitlab-api](https://github.com/timols/java-gitlab-api) - Java @@ -147,4 +148,4 @@ Issue * iid - is uniq only in scope of single project. When you browse issues or merge requests with Web UI - you see iid. So if you want to get issue with api you use `http://host/api/v3/.../issues/:id.json` -But when you want to create a link to web page - use `http:://host/project/issues/:iid.json` +But when you want to create a link to web page - use `http:://host/project/issues/:iid.json` \ No newline at end of file -- GitLab From 1eed8965783786b1ec07286e78f30750d48734a4 Mon Sep 17 00:00:00 2001 From: Cho Cheuk Ping Date: Fri, 25 Apr 2014 18:49:21 +0800 Subject: [PATCH 049/237] Fix typo: Confiure -> Configure --- doc/permissions/permissions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/permissions/permissions.md b/doc/permissions/permissions.md index ac4bdefddd5..9be6423f667 100644 --- a/doc/permissions/permissions.md +++ b/doc/permissions/permissions.md @@ -27,7 +27,7 @@ If a user is a GitLab administrator they receive all permissions. |Remove protected branches| |||✓|✓| |Edit project| |||✓|✓| |Add Deploy Keys to project| |||✓|✓| -|Confiure Project Hooks| |||✓|✓| +|Configure Project Hooks| |||✓|✓| |Switch visibility level| ||||✓| |Transfer project to another namespace| ||||✓| |Remove project| ||||✓| -- GitLab From 95ef25a57a872f6cc03416b4c88ca3b17a90f740 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 25 Apr 2014 15:01:46 +0200 Subject: [PATCH 050/237] Replace 6.0-to-6.7.md with 6.0-to-6.8.md --- doc/update/{6.0-to-6.7.md => 6.0-to-6.8.md} | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) rename doc/update/{6.0-to-6.7.md => 6.0-to-6.8.md} (85%) diff --git a/doc/update/6.0-to-6.7.md b/doc/update/6.0-to-6.8.md similarity index 85% rename from doc/update/6.0-to-6.7.md rename to doc/update/6.0-to-6.8.md index aa1b388fa9a..97f12d694fb 100644 --- a/doc/update/6.0-to-6.7.md +++ b/doc/update/6.0-to-6.8.md @@ -1,4 +1,4 @@ -# From 6.0 to 6.7 +# From 6.0 to 6.8 # In 6.1 we remove a lot of deprecated code. # You should update to 6.0 before installing 6.1 or higher so all the necessary conversions are run. @@ -33,7 +33,7 @@ sudo -u git -H git fetch --all For Gitlab Community Edition: ```bash -sudo -u git -H git checkout 6-7-stable +sudo -u git -H git checkout 6-8-stable ``` OR @@ -41,7 +41,7 @@ OR For GitLab Enterprise Edition: ```bash -sudo -u git -H git checkout 6-7-stable-ee +sudo -u git -H git checkout 6-8-stable-ee ``` @@ -90,11 +90,12 @@ sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites TIP: to see what changed in gitlab.yml.example in this release use next command: ``` -git diff 6-0-stable:config/gitlab.yml.example 6-7-stable:config/gitlab.yml.example +git diff 6-0-stable:config/gitlab.yml.example 6-8-stable:config/gitlab.yml.example ``` -* Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-7-stable/config/gitlab.yml.example but with your settings. -* Make `/home/git/gitlab/config/unicorn.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-7-stable/config/unicorn.rb.example but with your settings. +* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/config/gitlab.yml.example but with your settings. +* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/config/unicorn.rb.example but with your settings. +* Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/lib/support/nginx/gitlab but with your settings. * Copy rack attack middleware config ```bash -- GitLab From bdd392bd13fc19371bb09fd90e291959bc0fb4e7 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 25 Apr 2014 15:03:32 +0200 Subject: [PATCH 051/237] Use gitlab-shell 1.9.3 --- doc/update/6.0-to-6.8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/update/6.0-to-6.8.md b/doc/update/6.0-to-6.8.md index 97f12d694fb..5c71e99aa52 100644 --- a/doc/update/6.0-to-6.8.md +++ b/doc/update/6.0-to-6.8.md @@ -57,7 +57,7 @@ sudo apt-get install logrotate ```bash cd /home/git/gitlab-shell sudo -u git -H git fetch -sudo -u git -H git checkout v1.9.1 # Addresses multiple critical security vulnerabilities +sudo -u git -H git checkout v1.9.3 # Addresses multiple critical security vulnerabilities ``` ### 5. Install libs, migrations, etc. -- GitLab From 4618ec8791b10a9a98587e9a22b647581ac25543 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Fri, 25 Apr 2014 15:31:30 -0500 Subject: [PATCH 052/237] Fix unclear text in broadcast message view. --- app/views/admin/broadcast_messages/index.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/broadcast_messages/index.html.haml b/app/views/admin/broadcast_messages/index.html.haml index f28dadfb659..c58ca2c9a33 100644 --- a/app/views/admin/broadcast_messages/index.html.haml +++ b/app/views/admin/broadcast_messages/index.html.haml @@ -22,12 +22,12 @@ = f.label :color, "Background Color", class: 'control-label' .col-sm-10 = f.text_field :color, placeholder: "#AA33EE", class: "form-control" - .light Hex values as 3 double digit numbers, starting with a # sign. + .light 6 character hex values starting with a # sign. .form-group.js-toggle-colors-container.hide = f.label :font, "Font Color", class: 'control-label' .col-sm-10 = f.text_field :font, placeholder: "#224466", class: "form-control" - .light Hex values as 3 double digit numbers, starting with a # sign. + .light 6 character hex values starting with a # sign. .form-group = f.label :starts_at, class: 'control-label' .col-sm-10.datetime-controls -- GitLab From 25cc5fbf78196ba0629f72b4c37ed7f9d3b5eb53 Mon Sep 17 00:00:00 2001 From: Nico Suhl Date: Sat, 26 Apr 2014 03:43:24 +0200 Subject: [PATCH 053/237] do not html encode plaintext part of emails for push notifications Also-by: Andrew Karpow --- app/views/notify/repository_push_email.text.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/notify/repository_push_email.text.haml b/app/views/notify/repository_push_email.text.haml index b8d7fbeb046..a15b8efe1f7 100644 --- a/app/views/notify/repository_push_email.text.haml +++ b/app/views/notify/repository_push_email.text.haml @@ -17,7 +17,7 @@ Changes: - else = diff.new_path || diff.old_path \===================================== - = diff.diff + != diff.diff \ - if @compare.timeout Huge diff. To prevent performance issues it was hidden -- GitLab From 292c3c210b0b1fd932e8fad079e0d990e3d87039 Mon Sep 17 00:00:00 2001 From: arantir Date: Sun, 27 Apr 2014 00:16:50 +0300 Subject: [PATCH 054/237] Typo fix --- public/static.css | 1 - 1 file changed, 1 deletion(-) diff --git a/public/static.css b/public/static.css index aa834553a1c..c6f92ac01d9 100644 --- a/public/static.css +++ b/public/static.css @@ -2,7 +2,6 @@ body { color: #666; text-align: center; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - sans-serif; margin:0; width: 800px; margin: auto; -- GitLab From 5ac015664d6bc06fec5c3d16b9c5a08c8957d453 Mon Sep 17 00:00:00 2001 From: Xiaoyu Tai Date: Sun, 27 Apr 2014 20:25:35 +0800 Subject: [PATCH 055/237] init.d script copy duplication Copy init.d script twice in the guide. Deleted the second one. --- doc/update/6.7-to-6.8.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/doc/update/6.7-to-6.8.md b/doc/update/6.7-to-6.8.md index 63023fd384b..457433c6482 100644 --- a/doc/update/6.7-to-6.8.md +++ b/doc/update/6.7-to-6.8.md @@ -62,6 +62,7 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS # Update init.d script sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab +sudo chmod +x /etc/init.d/gitlab # Update the logrotate configuration (keep logs for 90 days instead of 52 weeks) sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab @@ -92,19 +93,12 @@ If you are using HTTPS, disable gzip as in [this commit](https://gitlab.com/gitl To improve performance, enable gzip asset compression as seen [in this commit](https://gitlab.com/gitlab-org/gitlab-ce/commit/8af94ed75505f0253823b9b2d44320fecea5b5fb). -### 6. Update Init script - -```bash -sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab -sudo chmod +x /etc/init.d/gitlab -``` - -### 7. Start application +### 6. Start application sudo service gitlab start sudo service nginx restart -### 8. Check application status +### 7. Check application status Check if GitLab and its environment are configured correctly: -- GitLab From 410790a355a6389bfa372e0834c31541b8ac8e4f Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 28 Apr 2014 11:48:18 +0200 Subject: [PATCH 056/237] Add NotesFinder spec --- spec/finders/notes_finder_spec.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spec/finders/notes_finder_spec.rb diff --git a/spec/finders/notes_finder_spec.rb b/spec/finders/notes_finder_spec.rb new file mode 100644 index 00000000000..f0588f56b47 --- /dev/null +++ b/spec/finders/notes_finder_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe NotesFinder do + let(:user) { create :user } + let(:project) { create :project } + let(:note1) { create :note_on_commit, project: project } + let(:note2) { create :note_on_commit, project: project } + let(:commit) { note1.commit } + + before do + project.team << [user, :master] + end + + describe :execute do + before do + note1 + note2 + end + + it 'should find all notes' do + params = { target_id: commit.id, target_type: 'commit' } + notes = NotesFinder.new.execute(project, user, params) + notes.size.should eq(2) + end + end +end -- GitLab From e5cf5f4f98464543ec2f06415e071b8110368cc7 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 28 Apr 2014 11:50:05 +0200 Subject: [PATCH 057/237] Notes have noteables but no commits --- spec/finders/notes_finder_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/finders/notes_finder_spec.rb b/spec/finders/notes_finder_spec.rb index f0588f56b47..3b28070ffaa 100644 --- a/spec/finders/notes_finder_spec.rb +++ b/spec/finders/notes_finder_spec.rb @@ -5,7 +5,7 @@ describe NotesFinder do let(:project) { create :project } let(:note1) { create :note_on_commit, project: project } let(:note2) { create :note_on_commit, project: project } - let(:commit) { note1.commit } + let(:commit) { note1.noteable } before do project.team << [user, :master] -- GitLab From 7339464e7701c0778cca12c12ace83ebd8ffe2f7 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 28 Apr 2014 11:53:37 +0200 Subject: [PATCH 058/237] Fail faster on an invalid target_type --- app/finders/notes_finder.rb | 2 ++ spec/finders/notes_finder_spec.rb | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb index 384316e14b7..4e80bd81757 100644 --- a/app/finders/notes_finder.rb +++ b/app/finders/notes_finder.rb @@ -12,6 +12,8 @@ class NotesFinder project.merge_requests.find(target_id).mr_and_commit_notes.inc_author.fresh when "snippet" project.snippets.find(target_id).notes.fresh + else + raise 'invalid target_type' end end end diff --git a/spec/finders/notes_finder_spec.rb b/spec/finders/notes_finder_spec.rb index 3b28070ffaa..27eaba8dfa1 100644 --- a/spec/finders/notes_finder_spec.rb +++ b/spec/finders/notes_finder_spec.rb @@ -22,5 +22,10 @@ describe NotesFinder do notes = NotesFinder.new.execute(project, user, params) notes.size.should eq(2) end + + it 'should raise an exception for an invalid target_type' do + params = { target_id: commit.id, target_type: 'invalid' } + expect { NotesFinder.new.execute(project, user, params) }.to raise_error('invalid target_type') + end end end -- GitLab From 0b615eb0e2b5cca7685360c0cae72484741d672e Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 28 Apr 2014 12:13:29 +0200 Subject: [PATCH 059/237] Filter out old notes in NotesFinder --- app/finders/notes_finder.rb | 8 +++++++- spec/finders/notes_finder_spec.rb | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb index 4e80bd81757..38d78f3a2d5 100644 --- a/app/finders/notes_finder.rb +++ b/app/finders/notes_finder.rb @@ -1,9 +1,12 @@ class NotesFinder + FETCH_OVERLAP = 5.seconds + def execute(project, current_user, params) target_type = params[:target_type] target_id = params[:target_id] + last_fetched_at = params.fetch(:last_fetched_at) - case target_type + notes = case target_type when "commit" project.notes.for_commit_id(target_id).not_inline.fresh when "issue" @@ -15,5 +18,8 @@ class NotesFinder else raise 'invalid target_type' end + + # Use overlapping intervals to avoid worrying about race conditions + notes.where('updated_at > ?', last_fetched_at - FETCH_OVERLAP) end end diff --git a/spec/finders/notes_finder_spec.rb b/spec/finders/notes_finder_spec.rb index 27eaba8dfa1..ffd3f5db815 100644 --- a/spec/finders/notes_finder_spec.rb +++ b/spec/finders/notes_finder_spec.rb @@ -27,5 +27,12 @@ describe NotesFinder do params = { target_id: commit.id, target_type: 'invalid' } expect { NotesFinder.new.execute(project, user, params) }.to raise_error('invalid target_type') end + + it 'filters out old notes' do + note2.update_attribute(:updated_at, 2.hours.ago) + params = { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago } + notes = NotesFinder.new.execute(project, user, params) + notes.should eq([note1]) + end end end -- GitLab From bbfa4a771ab8ca4745419b8d660af89249e088f4 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 28 Apr 2014 12:16:34 +0200 Subject: [PATCH 060/237] Always set last_fetched_at in NotesFinder spec --- spec/finders/notes_finder_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/finders/notes_finder_spec.rb b/spec/finders/notes_finder_spec.rb index ffd3f5db815..80d6a36c311 100644 --- a/spec/finders/notes_finder_spec.rb +++ b/spec/finders/notes_finder_spec.rb @@ -12,25 +12,25 @@ describe NotesFinder do end describe :execute do + let(:params) { { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago } } + before do note1 note2 end it 'should find all notes' do - params = { target_id: commit.id, target_type: 'commit' } notes = NotesFinder.new.execute(project, user, params) notes.size.should eq(2) end it 'should raise an exception for an invalid target_type' do - params = { target_id: commit.id, target_type: 'invalid' } + params.merge!(target_type: 'invalid') expect { NotesFinder.new.execute(project, user, params) }.to raise_error('invalid target_type') end it 'filters out old notes' do note2.update_attribute(:updated_at, 2.hours.ago) - params = { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago } notes = NotesFinder.new.execute(project, user, params) notes.should eq([note1]) end -- GitLab From 7ec5ff4dbae71d147f413da5cea64116e7eb305d Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 28 Apr 2014 12:21:49 +0200 Subject: [PATCH 061/237] Pass last_fetched_at for notes to javascript --- app/assets/javascripts/notes.js.coffee | 5 ++++- app/controllers/projects/notes_controller.rb | 3 ++- app/views/projects/notes/_notes_with_form.html.haml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index d200d962cae..043e4f62666 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -1,10 +1,11 @@ class Notes @interval: null - constructor: (notes_url, note_ids) -> + constructor: (notes_url, note_ids, last_fetched_at) -> @notes_url = notes_url @notes_url = gon.relative_url_root + @notes_url if gon.relative_url_root? @note_ids = note_ids + @last_fetched_at = last_fetched_at @initRefresh() @setupMainTargetNoteForm() @cleanBinding() @@ -76,9 +77,11 @@ class Notes getContent: -> $.ajax url: @notes_url + data: "last_fetched_at=" + @last_fetched_at dataType: "json" success: (data) => notes = data.notes + @last_fetched_at = data.last_fetched_at $.each notes, (i, note) => @renderNote(note) diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 85d042a89b5..3826515d227 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -5,9 +5,10 @@ class Projects::NotesController < Projects::ApplicationController before_filter :authorize_admin_note!, only: [:update, :destroy] def index + current_fetched_at = Time.now @notes = NotesFinder.new.execute(project, current_user, params) - notes_json = { notes: [] } + notes_json = { notes: [], last_fetched_at: current_fetched_at } @notes.each do |note| notes_json[:notes] << { diff --git a/app/views/projects/notes/_notes_with_form.html.haml b/app/views/projects/notes/_notes_with_form.html.haml index 3bd592e3982..bdcecd8a39a 100644 --- a/app/views/projects/notes/_notes_with_form.html.haml +++ b/app/views/projects/notes/_notes_with_form.html.haml @@ -7,4 +7,4 @@ = render "projects/notes/form" :javascript - new Notes("#{project_notes_path(target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}) + new Notes("#{project_notes_path(target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, Time.now) -- GitLab From 285926918b95f1d771bf4e9c84972d4e55b41ea9 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 28 Apr 2014 12:42:01 +0200 Subject: [PATCH 062/237] Serialize last_fetched_at as a string with seconds --- app/controllers/projects/notes_controller.rb | 2 +- app/finders/notes_finder.rb | 2 +- app/views/projects/notes/_notes_with_form.html.haml | 2 +- spec/finders/notes_finder_spec.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 3826515d227..b5b0446b43f 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -5,7 +5,7 @@ class Projects::NotesController < Projects::ApplicationController before_filter :authorize_admin_note!, only: [:update, :destroy] def index - current_fetched_at = Time.now + current_fetched_at = Time.now.to_i @notes = NotesFinder.new.execute(project, current_user, params) notes_json = { notes: [], last_fetched_at: current_fetched_at } diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb index 38d78f3a2d5..0b9affb716c 100644 --- a/app/finders/notes_finder.rb +++ b/app/finders/notes_finder.rb @@ -4,7 +4,7 @@ class NotesFinder def execute(project, current_user, params) target_type = params[:target_type] target_id = params[:target_id] - last_fetched_at = params.fetch(:last_fetched_at) + last_fetched_at = Time.at(params.fetch(:last_fetched_at).to_i) notes = case target_type when "commit" diff --git a/app/views/projects/notes/_notes_with_form.html.haml b/app/views/projects/notes/_notes_with_form.html.haml index bdcecd8a39a..052661962e4 100644 --- a/app/views/projects/notes/_notes_with_form.html.haml +++ b/app/views/projects/notes/_notes_with_form.html.haml @@ -7,4 +7,4 @@ = render "projects/notes/form" :javascript - new Notes("#{project_notes_path(target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, Time.now) + new Notes("#{project_notes_path(target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}) diff --git a/spec/finders/notes_finder_spec.rb b/spec/finders/notes_finder_spec.rb index 80d6a36c311..4f8a5f909df 100644 --- a/spec/finders/notes_finder_spec.rb +++ b/spec/finders/notes_finder_spec.rb @@ -12,7 +12,7 @@ describe NotesFinder do end describe :execute do - let(:params) { { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago } } + let(:params) { { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago.to_i } } before do note1 -- GitLab From c685024951b8fed73ab05039baa170859ddf7b12 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 28 Apr 2014 13:02:05 +0200 Subject: [PATCH 063/237] Add an index for Note#updated_at --- db/migrate/20140428105831_add_notes_index_updated_at.rb | 5 +++++ db/schema.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20140428105831_add_notes_index_updated_at.rb diff --git a/db/migrate/20140428105831_add_notes_index_updated_at.rb b/db/migrate/20140428105831_add_notes_index_updated_at.rb new file mode 100644 index 00000000000..6c25570f128 --- /dev/null +++ b/db/migrate/20140428105831_add_notes_index_updated_at.rb @@ -0,0 +1,5 @@ +class AddNotesIndexUpdatedAt < ActiveRecord::Migration + def change + add_index :notes, :updated_at + end +end diff --git a/db/schema.rb b/db/schema.rb index 17ca752db78..0a31eb7e3c0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140416185734) do +ActiveRecord::Schema.define(version: 20140428105831) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -200,6 +200,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do add_index "notes", ["noteable_type"], name: "index_notes_on_noteable_type", using: :btree add_index "notes", ["project_id", "noteable_type"], name: "index_notes_on_project_id_and_noteable_type", using: :btree add_index "notes", ["project_id"], name: "index_notes_on_project_id", using: :btree + add_index "notes", ["updated_at"], name: "index_notes_on_updated_at", using: :btree create_table "projects", force: true do |t| t.string "name" -- GitLab From c4b1a5f5ea338d9be6b24f29a562b567b3c2598b Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 28 Apr 2014 16:22:31 +0200 Subject: [PATCH 064/237] Allow nested files in wiki. --- app/models/project_wiki.rb | 9 ++++++++- app/models/wiki_page.rb | 11 ++++++++++- app/views/projects/wikis/_new.html.haml | 2 +- config/routes.rb | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index 163302a18f7..08a52782475 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -64,7 +64,8 @@ class ProjectWiki # # Returns an initialized WikiPage instance or nil def find_page(title, version = nil) - if page = wiki.page(title, version) + page_title, page_dir = page_title_and_dir(title) + if page = wiki.page(page_title, version, page_dir) WikiPage.new(self, page, true) else nil @@ -90,6 +91,12 @@ class ProjectWiki wiki.delete_page(page, commit_details(:deleted, message, page.title)) end + def page_title_and_dir(title) + title_array = title.split("/") + title = title_array.pop + [title.gsub(/\.[^.]*$/, ""), title_array.join("/")] + end + private def create_repo! diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 76f311ed0b4..c95b82734ab 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -175,8 +175,17 @@ class WikiPage end def save(method, *args) + if valid? && wiki.send(method, *args) - @page = wiki.wiki.paged(title) + + page_details = if method == :update_page + @page.path + else + title + end + + page_title, page_dir = wiki.page_title_and_dir(page_details) + @page = wiki.wiki.paged(page_title, page_dir) set_attributes diff --git a/app/views/projects/wikis/_new.html.haml b/app/views/projects/wikis/_new.html.haml index 8cb7fa8aa0b..1ce292a02df 100644 --- a/app/views/projects/wikis/_new.html.haml +++ b/app/views/projects/wikis/_new.html.haml @@ -9,6 +9,6 @@ %span Page slug = text_field_tag :new_wiki_path, nil, placeholder: 'how-to-setup', class: 'form-control', required: true, :'data-wikis-path' => project_wikis_path(@project) %p.hint - Please don't use spaces and slashes + Please don't use spaces. .modal-footer = link_to 'Build', '#', class: 'build-new-wiki btn btn-create' diff --git a/config/routes.rb b/config/routes.rb index f23542cc893..3e32068d8f7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -204,7 +204,7 @@ Gitlab::Application.routes.draw do end end - resources :wikis, only: [:show, :edit, :destroy, :create], constraints: {id: /[a-zA-Z.0-9_\-]+/} do + resources :wikis, only: [:show, :edit, :destroy, :create], constraints: {id: /[a-zA-Z.0-9_\-\/]+/} do collection do get :pages put ':id' => 'wikis#update' -- GitLab From bd8b2b7fd98faf3308cb1f722426ff8f7c39f1d5 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 28 Apr 2014 16:37:19 +0200 Subject: [PATCH 065/237] Default last_fetched_at to 0 for old clients Users who have not refreshed their browser tab will poll GitLab using outdated JS. This change makes the server fall back to the old behavior (send all comments) for old clients, instead of throwing an exception for old clients. --- app/finders/notes_finder.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb index 0b9affb716c..ea055694cd7 100644 --- a/app/finders/notes_finder.rb +++ b/app/finders/notes_finder.rb @@ -4,7 +4,8 @@ class NotesFinder def execute(project, current_user, params) target_type = params[:target_type] target_id = params[:target_id] - last_fetched_at = Time.at(params.fetch(:last_fetched_at).to_i) + # Default to 0 to remain compatible with old clients + last_fetched_at = Time.at(params.fetch(:last_fetched_at, 0).to_i) notes = case target_type when "commit" -- GitLab From 17b3da07ce90c0651303b4605a2ef634359b42b3 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Mon, 28 Apr 2014 14:33:17 -0500 Subject: [PATCH 066/237] Remove markdown notation from notification emails --- app/mailers/emails/merge_requests.rb | 8 ++++---- app/mailers/emails/notes.rb | 2 +- app/views/notify/closed_merge_request_email.html.haml | 2 +- app/views/notify/closed_merge_request_email.text.haml | 2 +- app/views/notify/merged_merge_request_email.html.haml | 2 +- app/views/notify/merged_merge_request_email.text.haml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index a97d55f1b50..1130969a26d 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -6,7 +6,7 @@ module Emails @target_url = project_merge_request_url(@project, @merge_request) mail(from: sender(@merge_request.author_id), to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) + subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) end def reassigned_merge_request_email(recipient_id, merge_request_id, previous_assignee_id, updated_by_user_id) @@ -16,7 +16,7 @@ module Emails @target_url = project_merge_request_url(@project, @merge_request) mail(from: sender(updated_by_user_id), to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) + subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) end def closed_merge_request_email(recipient_id, merge_request_id, updated_by_user_id) @@ -26,7 +26,7 @@ module Emails @target_url = project_merge_request_url(@project, @merge_request) mail(from: sender(updated_by_user_id), to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) + subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) end def merged_merge_request_email(recipient_id, merge_request_id, updated_by_user_id) @@ -35,7 +35,7 @@ module Emails @target_url = project_merge_request_url(@project, @merge_request) mail(from: sender(updated_by_user_id), to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) + subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) end end diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index ccbdadf010f..2a877bc1593 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -27,7 +27,7 @@ module Emails @target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{@note.id}") mail(from: sender(@note.author_id), to: recipient(recipient_id), - subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) + subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) end def note_wall_email(recipient_id, note_id) diff --git a/app/views/notify/closed_merge_request_email.html.haml b/app/views/notify/closed_merge_request_email.html.haml index 809d46f31be..574e8bfef24 100644 --- a/app/views/notify/closed_merge_request_email.html.haml +++ b/app/views/notify/closed_merge_request_email.html.haml @@ -1,2 +1,2 @@ %p - = "Merge Request !#{@merge_request.iid} was closed by #{@updated_by.name}" + = "Merge Request ##{@merge_request.iid} was closed by #{@updated_by.name}" diff --git a/app/views/notify/closed_merge_request_email.text.haml b/app/views/notify/closed_merge_request_email.text.haml index ee434ec8cb2..d6b76e906c5 100644 --- a/app/views/notify/closed_merge_request_email.text.haml +++ b/app/views/notify/closed_merge_request_email.text.haml @@ -1,4 +1,4 @@ -= "Merge Request #{@merge_request.iid} was closed by #{@updated_by.name}" += "Merge Request ##{@merge_request.iid} was closed by #{@updated_by.name}" Merge Request url: #{project_merge_request_url(@merge_request.target_project, @merge_request)} diff --git a/app/views/notify/merged_merge_request_email.html.haml b/app/views/notify/merged_merge_request_email.html.haml index 0c62d439aed..6762fae7f64 100644 --- a/app/views/notify/merged_merge_request_email.html.haml +++ b/app/views/notify/merged_merge_request_email.html.haml @@ -1,2 +1,2 @@ %p - = "Merge Request !#{@merge_request.iid} was merged" + = "Merge Request ##{@merge_request.iid} was merged" diff --git a/app/views/notify/merged_merge_request_email.text.haml b/app/views/notify/merged_merge_request_email.text.haml index 550f677fed4..360da60bc3f 100644 --- a/app/views/notify/merged_merge_request_email.text.haml +++ b/app/views/notify/merged_merge_request_email.text.haml @@ -1,4 +1,4 @@ -= "Merge Request #{@merge_request.iid} was merged" += "Merge Request ##{@merge_request.iid} was merged" Merge Request Url: #{project_merge_request_url(@merge_request.target_project, @merge_request)} -- GitLab From 274d6db18749f4fbcceabd3529b5bcdad9e5b5a4 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Mon, 28 Apr 2014 22:20:33 +0200 Subject: [PATCH 067/237] Added Node.js library link --- doc/api/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/README.md b/doc/api/README.md index b1740f35792..09c52350f3f 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -24,6 +24,7 @@ + [Ruby Wrapper](https://github.com/NARKOZ/gitlab) - Ruby + [python-gitlab](https://github.com/Itxaka/python-gitlab) - Python + [java-gitlab-api](https://github.com/timols/java-gitlab-api) - Java ++ [node-gitlab](https://github.com/moul/node-gitlab) - Node.js ## Introduction -- GitLab From c8c9c365a06f2cea7d68ea56b4c584ef7afab0e4 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 29 Apr 2014 08:28:03 +0200 Subject: [PATCH 068/237] Add apple-touch-icon-precomposed.png because of 404 on iOS devices --- public/apple-touch-icon-precomposed.png | Bin 0 -> 11979 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 public/apple-touch-icon-precomposed.png diff --git a/public/apple-touch-icon-precomposed.png b/public/apple-touch-icon-precomposed.png new file mode 100644 index 0000000000000000000000000000000000000000..6f2e0dd090ff597a7261de7b8b7d403a92691a51 GIT binary patch literal 11979 zcmeAS@N?(olHy`uVBq!ia0y~yV3+~I983%h4AU2EFJoX};4JWnEM{Qf76M_$OLy!3 zFfefWXF59v1Z3owxlq%ts6+?pGl9uoXg%=Y`eFHYVa4O6`H zgG4zLf}FY=L?)_fDRK&Ubto>pDH?cC(AAYi`ow|`=Dxm$9??J@o-VE%>`xRI^))Z< z=sNZLVfEtdYkR&wJNs|zb-U+lKF{5Jp8Ws^&omF?K+^`El}>Vk51Nl3Iri|0o_w47Ff}1uP5+r<0Q&GX&@|B&gRvyUfrq_s7g?MuzAqilU4Q zCNd}pr*^n7WLPt-IUm;L$`E0|Ad=>N#FF8LE`xz*c$x>phV2Xo&IxdDV&LFmFbM2u z)ns6)W=J@ptX#p+GLu2X?NhkTN9}b2&$SpBDrRo7*{Ndb+8E8DTgV(b`r5dc+8glCUr$_dnaY|NoJ_taQXPX=j9%$m2kv!akQ-J)e!1Ds?(d(mbkq>3_te&X5A~u=%o42|^M9G0i-x(M_?an`VMT3L6A*1=>`SSno?f<$jP-SRH z^PE)3z!2x6q8D;%v;A=n1_qY}janNVrN11M&^f>+bCC7ULGC{ZW-U%CM-Dj&IB}&k z$P^`Lu4!`8Xgj+>Rx3gOii51lfxwKm$pw6RheCJo*%t8sO5~V#P-9OcCyV0=4&g+_ zTOEu^T@lKC9O5%ue<&XGU=iw8Q8?Kl5~$=o(bU5*s4GMv)I;`@Z4r}YdyLzziPk3= zjGF$m?Qu7p(zq$m_6pBd=bbCerCQt;abHL&F`U&ewqW*!qAgOkJ!T7^Us#>Nf2-fl z`MAM>7ZU8oM{*4GjvaQ|XraS7Ir;QPr8PXOk4bF^Tf@A&^K0_?jpZytjjjhc%~;Bv z6cXheJtBM}{BC%xP>@kE5xm7|&dJ;oct~Ao@(S-QYP$q~9+5~gGHj3V&{4i7)Gw?r zP~G8t#9T$F)7eOU=L9CtjY~o<30-o#lozD@QfK9C6Avln$tQ26WN%`(oT8(keWLZr z+$V>h7(bDIqWCGAYi^Q5;gTQ0k2Hc#WqCO= zyKr03`oQ)T!X~A&EYCKJd3rBhyJ+fVsSNRq@0sggl5}CV>u2~Zlf2w5c|63x-0<~`=QH_d=7&aTZPTg|op_3C zs@GJtsnS~dAuCrcTXk<0cj)KP(;@vU|h34*NSV30$x-{_&n;3f#$(n=5n_vw2syl{T6lQQLU-W=)ya z?iqh&cX!*aTDj2D+1SfCd~?v}DQWiXk7pGAm{a1%`CMc9^v`u&_e9=nKGKw4X5zEc zFf}H7)wJo;B365>4qWa2dav2Kx69`)+v~bJ@^>Sj<8d$b7O*#OV)PChojwv-ql8uN!|)=CPQ^DvxuI z^-<}Xv z5v8+j#kL)(o|~RTEsK1&ZBJfnlx5`7h|s9m&2DSwu2sFZd+qM!g3EXMP4-(o?^^od z4Ij6i+_rMN2m;Zq7UV+M{2lz0^;SI4^MihVkQV!lyNlWX=tqec3%-Jbh*eVsdd^Xx-!SKMCz&g@<0yY@Tt&zQ{DoEK?aeBtm3 z=LdmLFWPg@pK6eOe@&ggvwvgy*5}Il$@&w+*IwVSeQEis?}_il?Y`L+&3|n7*v9;x z(Y?s{Gv)`jpV)rd|8V}i_}2T*^~(QK{#X6K$gsRYl`);Uv(d3Jn(6nCsv5=pefCzj zQ@?Gx`PQ*#!A?g}$Nr|ZO-~Q5Rm?c?X2M#<@6TtPn|LmhuQj0V#kC9UiO&+d57+Ui zx3;&2x7qgEsi(EhEH7u@{XcI%w?CTui2HH1_ze9Mu?3Y2&mH>Gx?F6fo{)~! zGzXs!KZ_|J90jyii1ny`5-wNm5k5zqFn$+FyJQ&@SM>#-=Sc3T+R8k-$m+q818`mcT) zK7C!?UbQOU?8dl*ru+QIBlIKhZ%zEwHdoqCw6klS$ZhfI zqV+d4?o>RLZqGlpf99PjTUM?5sLVksqy}NXGYvT1Ec^BVFSMT{| z^5*L8=sn;6+MV2YJCrfh_iEbJ)Zd=JH-EQZ*SYHDk7>ViW7qoS7QQ{se2MulyE5Ol z>pQPpmAzye64ZZ9`?WjYaru4!=Dsi2FOa zA^TGo6M z@Ezf^)?3BrzAAZT^KbHH|Kq#o?4Gr5XH53acU610R;PV`DLv2p+}$sGD?f_;zjk$= zrS09lpR4k}AN~IIzS!NmBK5!LPVc^1uKsTA9{)Y@UmV^#-gLg(e$_tu-<=!p@6=}< zC|~gT;vM(zY^}}b|4sbb&+p9IKePXI8*kg|c@}n-mXGX<{=WRP-1&UUd9``s{}%l_ zy-r+AzwXD?*VoTooN;mC^iR_#@6WAS`uEj=*OKdRA3JnRZr{lYW5c*FVZYxVEWcAO z`+o6#e*Y&m3iTTQGk$LT8hl~-@5z#rC;w+*p7Hrlva#-M1_lO&WRD_K6k;fky8V(*jcaAM)EUBAxxv0VJuvvOibpIPz_ zMxVH2mwfD1ZrGcvr%y4w{ETPXsjjXM8?yPzp1oSt)n)MW&K&-poT%X7d0gBDs_IAg zc=+DS&t9mYUU%TytFyDOt8D#NJ@KC0kqZ|d#9ZFFY0;k_8|ZbjIezvB!3s=&<>6>=$_Q{C)YXi3*b^3H9)PXPf_d zm5#n5+qCIZe^tz#Fim9ZR-?5mR?OJU5x8Pv%MJIb7}ZN9NbA z>d!^?6Rw2tNZq{>@Hi#E?%y9tx2BpO3ZJfYCii~*s^`aERJ@5pU)o#yxAQU~A1|*M z1JkcB@2u>$ySKb@XIWd^z6QsB0p`DdYTmqAlODct)hVO5wONOn<^=M;3zkX05)!_| z#@pucW5JSn3u{yUJeF{;<~HFfwS4kNQJlT2a6`nGsTTwa4Hq*1UTbyhcKX~$j_K^2 zhK(C*86CAwdAG3cjN3C~u3b@u#LL&UUM?NqmpnIg30D{OPCA?ycj|0i`Oix~4=}{L zHTn3|H8DK5^Td>E&+fZ7GtNQc#p_ciPu^2j`td21YiH7t z{qOH{KTo+YCnI8z+%?y(vV{G0TeqU){W+WGT9y7e*v!Gu@H=t(>V*e;SRyCPUbuAS ztqV6;7&P?$ojAPJ*iy6Zkz#4N`JrpKTqg8?&im2(QnGu|uHC!2KN-v0?t1^c`qC+; zb*ombS)s6Y?MfBJQ`N7IT+HX&eQ(L$h^>$K8SC=m-%mEY$lt}aY1i)E7c)!_ht_`o zHg!&qgiqX}HEW*Cj@o;^BAe;@y7lW>86u*i@9=V`s+_oXO)OM&>84BiRWlBhnqEnm z{4?>%--5Vzcg@VE#m2^(@MN4+o<4p0QQN+cU%wd`Uz<2pZ1PmW?VDPDSIym1YWw8p zXZ+D|>_xdO7U-4z_y1OUewLBL*G~@7z0Da4!oXU>hzI>5-mA%i` zTXEZ#+uPRo`+Cmw`F1OMw$7Ochn)6EzQ3fNDfo$l^`|A{zq)0|s#bYj^6J{eKKE_% zV&&{r-kjGGI}$d&nDy$?j29m2?AD^HmZqYaJ0^bH>G1!NKWng(*OG|f;H3-K>FBG^ zoIl_8WY7NU*=o9qpFSolGAvm8bo0iC`+9oHdssSMl;+NTD`#8fz;ko?N$jHH35~-lYjt~_o%BM&r=Gvi6q)+6^?`zP zwy~&dCTr!&2MadK%C4QPUqA8tyAK6#tzNyeTFRBnbA9XP&5D2KPM@BhoEjDMsdJ(N zBSYQ3<$L_91^(C0{#SML($PTvWd2hKn~HR8W3*Z__3NS?NvTu`}mS7jAX(+xOpLVSu_#KNn|# z%N^duCpK+g{yWHHL)$DSA4jVT_jm8wmD9II_rb>>t4>{FsLz-1adVa}`+2GL-o1Gn zdtYY!tW#B0Oyatpot-=Lm4$@Py5}Uhq z=f=EKn+vrIu7!!MSraYTac(7_OZBeZPf}E;PEBcVZ!d^=)BAeir=m#(&To$#srWG0 z!|BiC+Ni7|BO$@^!-8|)y5EhpxLH1Jnn-_IF_-7p?_aq-6iU3v5^|Q3lG4$A@bcw) zNq(XB!@K0R*jFD*zcVYb^y#Umr_Zs@o4HDK(`I`KsaH2{&1k*5Yt{0_>y|E@^hbrU z|8UcLF9V5^Pm@_<=k9%_Wi%%z`iSe#OYYw@mYba3C0zG;d;EWW>({TVZf;ILS+#2x zhl}-NM<#~6ySoyTIn`$xS>L+-@B8^%^WL5FyynVq;O%YmDX^Mn zg6)SJ-iK|7D7kSqyX{wX<<4!nG5e1le|}_2L{edfo}Za)?%6_T@A<;-+GCe5IVR!| zHf8#YS1X>Ur1#HO+_L@O_xJOU_sh=Wan)gyeehma?a<3N35iSAS6;chb?;u@KLVF7 z-jjRr{`A3ZqD=}r7M9h=e^)8Ix1+4|=cc8qi*t<_7VKW_T|WQVXdj6?TN@mlJoeU27vU|dtHQ%#V8E`Z$QE|N; zHG9A0{`KpB@BdnV`&LvhZ_O_g$L#f7OpP<#CVVX1_x?8NUI>eeCf(h(bJM1#mQ+{Qo4dAZPZB!5)&FYf(@&Qct&hK0 zRMj|5n_2PT^DiY=0+p3j9`3Z9x!hmw<@@)_Z8K)ibP!0%OY3mtZ=V0g!B}zgiG_}; zGepFn_w`*goA%*KK)iQ&_~a+*>Nb40BW7MoQ;l-?_U&uNyHMWUrE~vW-2LUsp(g#$ z!q(B=98G-kWeXGg{w&^bgqa~g*~7b7S&?zwyNk|N`Imw!ca)i$*2;zR7Hw8N($Z~T zyX0-GN!+8#e>$EqQ`Ya=)ZU{KU?)6{R-7k<7kr#!lk9zSYyDyFB9?c(*z zy2`qK5%ZIs<}6XMuhdagyK?{f=?Pa}uzD^i`!Qkh%1*}OYZgcKIP-Is)P6bP*fyn( z?aGNecXAx-`r3YFsV!XT6`QMSFCSg!`0mYh4;``Ww5*b2*SkGi%|3p!OHE`u{;*&( z&!^gB(VCnW->vgg6S}oz_3GfLAd}Cv$8?&vY&7Hl@O|#9^&Y)P`mw&_KfVGcdlKsFuG$NxJ*sA@!!5He5cL`oH*2E!y6jmTB(^U(%wFi|K0sI z>6c!fZyr9nadcZXyS)DLMT?qRCI8eNd3$Y|THB0H#Y^|^Po5(1_DRO_Wy_Q_4xBx= zZE|z&@)aEo)0X|3dSQZ|3%jk?v}q!%HBQ$2im=F5=$9`owykI|>slYbl#84D+@-_6djIzPGYfiV~)|O=V!1Fn#jVvJ;uFr}cJ=>$j{pG3~7Mx|X&Jhd(X2 z{7-nE+-BxYix)e42e)nu?iDQ0TNAU9XI6_�Cdv-f6QYnS9>5VabvcUl%<7WdD!d z*RN0B+UN7`NkWgem`=5}x|PnDa^vjlRa#svv3;7J*V@ZZ|BvAEbrsW(%g9c?_+@9} zmMi}Gt}cAMKYq>m@%?`31(BzxuB(@5En6TjUzb$*Mj6ctv)#dbh ziGG+7LrQh@>`jY&e7@L9)kzDqdvgnSs~OUd?23dVOuJ zu!x9=sOZ#5lO8>P9=|DtbL))VWt*NnPc>X+=~}Yw)vFBOn5vxI-0JG;=;-L#vuB?^ zb?V$4%g?v-_fK>W4h($x^5sI``5!i9|Jo(x?96P;Xk_(j-;^Bzm6e*g&bi{^>{-)- z0s~K;KQAvK;h;28LqyBky87dzqbgUE-t2$LT1+z#>N?PVU)H0YL^JKPpep_4HyL)?2pF8Krac5)m z(q*f9%xc}*+D%QTaK2mER8AJA#Kc5Lj_DJ{-oIY#DsL|C?!?tCrrXugA(3q@EG#@}`|H=Q z`~T+p`0!MU)&0-)40@DYHT&1Es6xYq)q)R$lPonS_|AW=<5RNJBH~Ss?~NN}J9b*} z@qW9wX5DMYQ;%f>11~lmSy`zfcx_E&aM-u6Io4dQO5cLkvCA%7<(6}XIq6jP z^>w*fSxT8V#Pwn<9Ge#|TNI z-x?ZSc=+&6TDg(a)%b3SK0gb+O?3iaeJGdTy1J< zI()cgcYVbp*2mlP@9V|xx^kst&gu0xZroty7Mt*APU`Drw`O^@Nu)2>fBqIzUN-CU z9n#L?C%%}kuh>zxbop|_0>d?Hw@&PzK6%d4hK2(XZ@as@!`DW!wjVwj%)!g6`g853 zNq-(Z*q(k_?l@m?4u4FH#vO(;XU?en(qLtnGG)pH{nu+^eje|>^1PvN_A(2ZQvu<3 zZ(i)1SgXQxQB&)Xc-`+`H+&v_{E_(NK*aL*CLX?_mbc%%eZsbNlhpI4i#BbVWMC|v zy^LSpZcY6Dc~9E+|M^sZKjxjJ)Ehye2Mf)nZ{5Cqeu7v;SlG5&>y?M3WYwk@Oj#=(^ zFWk8!BP{>Tw(Q8vSL;lt9(jI#{`S((Y&#~#9hn==`?cpLyK2;Iq`(eCnNFWeKTIPi)8ZheT(P$rZ4gSXP4j0w=Y+%UVZv>ty}ftO~RAL=tXTSH9NQG#~lm$m_KXo*SI)0 zA7@`hZSBvOmmfO#PwvW>JD9--IN!CaVZmEI_hwJ8*l{B$c-e=e78$FazPNfi-Db}1_ji`X zbR{p6pZBF;_L)yyiaj5>E%gnqtOzea7_4VhD99X#L#x16M7Xr*Hg%b=jt~Zyd z@I71>ZPO=jSNcfeXrI2#n^_9>;dy>$XOru8Iehz~@MOvN0PB$NJ2wV~SLZ+3`yo^R z<%)^(R>rT9k(7J$W`pfR_4;h{by=&l zC&`EXd-QnCmWaSO9n;izzZTA)srkND!9LelwX6ECva*M$s^p`!dm@=T4<~Ik3Dt|U zaX;&pnW_II^{7YNE&Hi9RbK*pUFSWRJ9W<;mLJub*_!^TiwtcQ7#ZH*-!J;$@tQ>s zc8mJYi8*z$WBRmdP4iDyaw{(HQv(u-G6&Jt#_2HrI-}T8ohnEP?JI?df zl(XAYWPfIj;gR^bust)qR{japOiNk9{i%3KkKB7@$(4@^B5ZTNPFC+TeA3&)*y+Nj zseLMLmxzs{ddZuP*{c@mEZY27edWZXN9A3=e{i+k9rN7&mN3Az!C1r!^X+Lv9rK0hyOpz^|w`30;jw-@qOENIdS)$H{X>G z{n=AfQ@u~Msj2DCotTY={L4EZJxJI;si|l2UQ<5z%Dn=uPMz-_F0Eg3s$#;CMY(CK z@>3Iy9Oo=s=EiCGFnC^1{DIYLS3Y@m$Mj_HzpL8+r%#+{CM)9J#{RX`^r71?k5_$0 z58bS$i4`0>SFdm^joGqC$CI+t^-`-!KT4AM8RXz8~qZ@&7|2m_7eShD&@%_DP0pW)~gd0n! zIR3tJ<;q;^Z6V>IehKeBY>>XaE$__9lSvDFJ731^7W#C1y~w(?^X;B?9$zTwH*rEl z#0}oCX=hvdcLn+EU$P_P_&45`r50`Ci!&KH8Fm!@z4UHww6ydq^$y_&?~iYKdjHd= zNiP#-e$=bI+_t}yqds<%LD830S4yrNU2^2c{%d;bzlzoCU2ALKuA3WuIIqobGG9-A zROh48Tfq?%cCX#a8BkuBlAV0))F=6c$CD~5v$EDSYo2fv*iwD{TgxEaeva^d9Pf%FC{`|_9mlLHNnHXaDtX659?CtR>adnCH4RnfO@%|?3+{Pi* zd+L0(f5|U%*`rH$?5H^XjCZ-8%yO$fS;=YB1d2*aXN3j(>w7dDfB8D=MOL=Yg?V4T zfA{q4%Fcd!^zpvg`rifG7u(+D;QKar+cmK(29FDN?3L)-SPF98m0f%Qv zb*UZuCA{Iy%eQwA?z(vF(u@zX7cI|C^4PeYU2$8xzi%X;bE-H$Lju$F>vxxTIVmo; zj=xayT#}(dMk=VuGkV71<8l6q6E8h#D$Sn0d$*;}{fd^2GY>5YjH(X(QEAyWu~|g< z!N-bX;~kqO$yEI@kKTWN+1J(Kv*c7+HM6?ySUi0?qW5O~ylefic&2KgHhZ=8G~L;+ zva(mWZZI(q3z_ih?c13%_c$0&t8{VS&E<2f>`tinr8l-+RU1-1?pf|H{9Mg@kzL$! z+iPp$!XhF(u03I5VBl-ty2&IkaFS|_$&8sX4#t^H_vY#Ombz+lPYyiqERqzrr{drC zcyXKhX(s8fAGLBb?*F&xf$uHtu8VBHexLE-{g%1v%eOCQQX*T@ZU{6p*INA!dFZxl z?%WXX)yt1he0sX>RfrC(&ddbvV*d9G-|H^;iS z`qjJ7p6v;l`qauQYUR^w2k+%wKK4H!+~DBu0O>B;l-^^srg|8Kr0a{G2y zS5c)Ur+K)#i4=3%;_~*iizac)`@Oxp_Ei0xBULhEPm6-QdwMnZ+4V2px^3CMecSf! zU%!@JT%6@tcWsw_xJ*&uf*&TPrjb!WH?E&97VG6an`gLRq{uH~!smx87AsF`x^w^b z+4H9ta!j68Qz|bhmzVcX=DWqM%b#Z$#>B_?xHQZUZ|2)64`1toz zvV5{nr%zk^y0`bM=Cz~0zvsOdO#D#x|2w-7!-N?U`bW;!PCZp_EcNR3jhp3>ku&^@ zoId?}TD)T-qqg>G`FfrBjY&^e8E#5C+9j&}Pe4p;N6}NJJfZvI>U&o2-yiSd5)kZM z`bPa^XI9KE2^EzCQ|H+Hmftwncfyga>;CM?(JVZ;*qu*lf6kiz&Ed((hqvXnnQA;8vD8&Pw79H( zU(wb+{e0QcXBr+13{t&zuihOxe|+AzU#gtm>nFdfvDqzkjHg?|;K0vI5;pfY)+Rgs z*|B=Je%z9RP5GZK>Li*S&qo%Yjh(q$y>D&fV) zoB7FS-7%_4Xq!?&k`f&z4SLXqfa!iM7%*SNH0+Z5z#xe(YmkV|qoT zde?47ex|Cr zbNTY)m+ak1|MMIsc{trkPE^d(_O^JqSoi2r`Kwcx3O!!DEJRI@?RR9f6cdA+Tbu6L zUYC{%Az``t0&r9}Kax$z~qhW4#;e^cIeO_yg1P?2}zrSt! zW)_A$zW&03j|>g3x%cey`zv=hv}V2OB#njBn<{sf&HYru&QO!LX8Tq%O+CFu$C@QR zy}3C#*`06ORV4g@ylSFMR&4E!Jgmo98or*|%$tvAxvPuQ(>uq0>sD0Vn>qg;DAdcLt*C)7xoPE`1YdFkS#VRY e^YcF=LtV@UvC|H5+ZY%a7(8A5T-G@yGywp<1#3$H literal 0 HcmV?d00001 -- GitLab From c7dc20c1202d6cd9d7593de76718e16c4d601980 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 29 Apr 2014 09:11:02 +0200 Subject: [PATCH 069/237] Add new entries to CHANGELOG --- CHANGELOG | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index a5671948a6f..1922abe572f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,12 @@ v 6.9.0 - Store Rails cache data in the Redis `cache:gitlab` namespace - Adjust MySQL limits for existing installations - - Add db index on project_id+iid column. This prevents duplicate on iid. + - Add db index on project_id+iid column. This prevents duplicate on iid (During migration duplicates will be removed) + - Markdown preview or diff during editing via web editor (Evgeniy Sokovikov) + - Give the Rails cache its own Redis namespace + - Add ability to set different ssh host, if different from http/https + - Fix syntax highlighting for code comments blocks + - Improve comments loading logic v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion -- GitLab From 513dbdbff31bd81243ccf349e3932aa02f29f05f Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Tue, 29 Apr 2014 11:49:42 +0200 Subject: [PATCH 070/237] Remove redundant signin link from signin page. --- app/views/layouts/devise.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml index c5041dd71b8..5d93ffa50ad 100644 --- a/app/views/layouts/devise.html.haml +++ b/app/views/layouts/devise.html.haml @@ -10,7 +10,7 @@ %p.light GitLab is open source software to collaborate on code. %br - #{link_to "Sign in", new_user_session_path} or browse for #{link_to "public projects", public_projects_path}. + Sign in or browse for #{link_to "public projects", public_projects_path}. %hr .container .content -- GitLab From e52f50c22fa0ca855ad75208b511bf27967e92ab Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 29 Apr 2014 11:54:09 +0200 Subject: [PATCH 071/237] Do not refresh notes on hidden tabs --- app/assets/javascripts/notes.js.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index 043e4f62666..2599a0ea4fd 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -72,7 +72,7 @@ class Notes , 15000 refresh: -> - @getContent() + @getContent() unless document.hidden getContent: -> $.ajax -- GitLab From 0b914e7ceb28c67a50d19c7fac10a95b3ea4a1fa Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 29 Apr 2014 17:06:56 +0200 Subject: [PATCH 072/237] Refresh notes when the page becomes visible --- app/assets/javascripts/notes.js.coffee | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index 2599a0ea4fd..8b152005639 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -50,6 +50,9 @@ class Notes # hide diff note form $(document).on "click", ".js-close-discussion-note-form", @cancelDiscussionForm + # fetch notes when tab becomes visible + $(document).on "visibilitychange", @visibilityChange + cleanBinding: -> $(document).off "ajax:success", ".js-main-target-form" $(document).off "ajax:success", ".js-discussion-note-form" @@ -63,6 +66,7 @@ class Notes $(document).off "click", ".js-choose-note-attachment-button" $(document).off "click", ".js-discussion-reply-button" $(document).off "click", ".js-add-diff-note-button" + $(document).off "visibilitychange" initRefresh: -> @@ -453,4 +457,10 @@ class Notes filename = $(this).val().replace(/^.*[\\\/]/, "") form.find(".js-attachment-filename").text filename + ### + Called when the tab visibility changes + ### + visibilityChange: => + @refresh() + @Notes = Notes -- GitLab From c8cf90d28655b49d10e6d7b9b82ce3cda41089a9 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Tue, 29 Apr 2014 17:23:29 +0200 Subject: [PATCH 073/237] Add document.hidden improvement to CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 1922abe572f..1e9aeefd19a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ v 6.9.0 - Add ability to set different ssh host, if different from http/https - Fix syntax highlighting for code comments blocks - Improve comments loading logic + - Stop refreshing comments when the tab is hidden v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion -- GitLab From cb69baedd335b0609503502080fc684520b3794c Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 30 Apr 2014 11:48:46 +0200 Subject: [PATCH 074/237] Remove empty line. --- app/models/wiki_page.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index c95b82734ab..535bfb5b28a 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -175,7 +175,6 @@ class WikiPage end def save(method, *args) - if valid? && wiki.send(method, *args) page_details = if method == :update_page -- GitLab From 193a9e7d4c7b516fa1ed1c23eeb89ab71c316019 Mon Sep 17 00:00:00 2001 From: dosire Date: Wed, 30 Apr 2014 13:35:35 +0200 Subject: [PATCH 075/237] Add link to slack docs. --- doc/integration/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/integration/README.md b/doc/integration/README.md index 3e8d329d558..8318113ce92 100644 --- a/doc/integration/README.md +++ b/doc/integration/README.md @@ -6,3 +6,4 @@ See the documentation below for details on how to configure these services. + [External issue tracker](external-issue-tracker.md) Redmine, JIRA, etc. + [LDAP](ldap.md) Set up sign in via LDAP + [OmniAuth](omniauth.md) Sign in via Twitter, GitHub, and Google via OAuth. ++ [Slack](slack.md) Integrate with the Slack chat service -- GitLab From af2a39470f6c7e548355d5f839a9251620a870ec Mon Sep 17 00:00:00 2001 From: dosire Date: Wed, 30 Apr 2014 15:00:49 +0200 Subject: [PATCH 076/237] Make import docs more prominent. --- doc/raketasks/README.md | 3 ++- doc/raketasks/maintenance.md | 29 ----------------------------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/doc/raketasks/README.md b/doc/raketasks/README.md index 9aa80af12cc..6be24f0102a 100644 --- a/doc/raketasks/README.md +++ b/doc/raketasks/README.md @@ -1,6 +1,7 @@ + [Backup restore](backup_restore.md) + [Cleanup](cleanup.md) + [Features](features.md) -+ [Maintenance](maintenance.md) ++ [Maintenance](maintenance.md) and self-checks + [User management](user_management.md) + [Web hooks](web_hooks.md) ++ [Import](import.md) of git repositories in bulk diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md index 3033d8c46b4..2783c4153c5 100644 --- a/doc/raketasks/maintenance.md +++ b/doc/raketasks/maintenance.md @@ -110,32 +110,3 @@ If necessary, remove the `tmp/repo_satellites` directory and rerun the command b ``` bundle exec rake gitlab:satellites:create RAILS_ENV=production ``` - -### Import bare repositories into GitLab project instance - -Notes: - -* project owner will be a first admin -* groups will be created as needed -* group owner will be the first admin -* existing projects will be skipped - -How to use: - -1. copy your bare repos under git repos_path (see `config/gitlab.yml` gitlab_shell -> repos_path) -2. run the command below - -``` -bundle exec rake gitlab:import:repos RAILS_ENV=production -``` - -Example output: - -``` -Processing abcd.git - * Created abcd (abcd.git) -Processing group/xyz.git - * Created Group group (2) - * Created xyz (group/xyz.git) -[...] -``` -- GitLab From 9571743d8f46e583a4edb465b831f495d642bf32 Mon Sep 17 00:00:00 2001 From: dosire Date: Wed, 30 Apr 2014 15:02:37 +0200 Subject: [PATCH 077/237] Import rake task documentation in separate file. --- doc/raketasks/import.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 doc/raketasks/import.md diff --git a/doc/raketasks/import.md b/doc/raketasks/import.md new file mode 100644 index 00000000000..e11328dc5ce --- /dev/null +++ b/doc/raketasks/import.md @@ -0,0 +1,28 @@ +### Import bare repositories into GitLab project instance + +Notes: + +* project owner will be a first admin +* groups will be created as needed +* group owner will be the first admin +* existing projects will be skipped + +How to use: + +1. copy your bare repos under git repos_path (see `config/gitlab.yml` gitlab_shell -> repos_path) +2. run the command below + +``` +bundle exec rake gitlab:import:repos RAILS_ENV=production +``` + +Example output: + +``` +Processing abcd.git + * Created abcd (abcd.git) +Processing group/xyz.git + * Created Group group (2) + * Created xyz (group/xyz.git) +[...] +``` -- GitLab From 5bf12bbb1d05e0f4fc2661ccd68e0c208499ba57 Mon Sep 17 00:00:00 2001 From: dosire Date: Wed, 30 Apr 2014 17:28:05 +0200 Subject: [PATCH 078/237] Make clear that notes also serve as comments. --- doc/api/README.md | 2 +- doc/api/issues.md | 4 ++++ doc/api/merge_requests.md | 4 ++++ doc/api/notes.md | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/api/README.md b/doc/api/README.md index 09c52350f3f..4ef4c031bc2 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -13,7 +13,7 @@ + [Merge Requests](merge_requests.md) + [Issues](issues.md) + [Milestones](milestones.md) -+ [Notes](notes.md) ++ [Notes](notes.md) (comments) + [Deploy Keys](deploy_keys.md) + [System Hooks](system_hooks.md) + [Groups](groups.md) diff --git a/doc/api/issues.md b/doc/api/issues.md index 823b72f5b0c..d18506f9ce6 100644 --- a/doc/api/issues.md +++ b/doc/api/issues.md @@ -193,3 +193,7 @@ Parameters: + `id` (required) - The project ID + `issue_id` (required) - The ID of the issue + +## Comments on issues + +Comments are done via the notes resource. diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 2996f609d43..d5b106729c9 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -258,3 +258,7 @@ Parameters: } ] ``` + +## Comments on issues + +Comments are done via the notes resource. diff --git a/doc/api/notes.md b/doc/api/notes.md index b15ebdd2bac..e9ad6e00c73 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -1,3 +1,5 @@ +Notes can be wall notes or comments on snippets, issues or merge requests. + ## Wall ### List project wall notes -- GitLab From 469077e55dab70dd392eb7a62d6a8c6764d6d784 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Wed, 30 Apr 2014 12:04:11 +0200 Subject: [PATCH 079/237] Add help link to header. --- app/views/layouts/_head_panel.html.haml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index d8001fd76d7..f1545c6d089 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -19,6 +19,10 @@ %li.visible-sm.visible-xs = link_to search_path, title: "Search", class: 'has_bottom_tooltip', 'data-original-title' => 'Search area' do %i.icon-search + %li + = link_to help_path, title: 'Help', class: 'has_bottom_tooltip', + 'data-original-title' => 'Help' do + %i.icon-question %li = link_to public_root_path, title: "Public area", class: 'has_bottom_tooltip', 'data-original-title' => 'Public area' do %i.icon-globe -- GitLab From 2242c074afc637c3ef2f7f9367fa60aab7c7f50b Mon Sep 17 00:00:00 2001 From: Job van der Voort Date: Thu, 1 May 2014 15:05:22 +0200 Subject: [PATCH 080/237] improve headers, add details --- doc/release/monthly.md | 67 +++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/doc/release/monthly.md b/doc/release/monthly.md index d57934891df..2bd1b2f4f4e 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -14,30 +14,30 @@ After making the release branch new commits are cherry-picked from master. When * 23nd: Optional patch releases * 24-end of month: Release GitLab EE and GitLab CI -# 15th - Code Freeze & Release Manager +# **15th - Code Freeze & Release Manager** -- Stop merging in code, except for important bugfixes +### **1. Stop merging in code, except for important bugfixes** -## Release Manager +### **2. Release Manager** A release manager is selected that coordinates the entire release of this version. The release manager has to make sure all the steps below are done and delegated where necessary. This person should also make sure this document is kept up to date and issues are created and updated. -# 18th - Releasing RC1 +# **18th - Releasing RC1** > Yo dawg, I heard you like releases.. The RC1 release comes with the task to update the installation and upgrade docs. Be mindful that there might already be merge requests for this on GitLab or GitHub. -### 1. Create an issue for RC1 release +### **1. Create an issue for RC1 release** -### 2. Update the installation guide +### **2. Update the installation guide** 1. Check if it references the correct branch `x-x-stable` (doesn't exist yet, but that is okay) 2. Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) 3. Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) 4. There might be other changes. Ask around. -### 3. Create an update guide +### **3. Create an update guide** It's best to copy paste the previous guide and make changes where necessary. The typical steps are listed below with any points you should specifically look at. @@ -82,7 +82,7 @@ Check if the init.d/gitlab script changed since last release: https://gitlab.com #### 10. Check application status -### 4. Code quality indicatiors +### **4. Code quality indicatiors** Make sure the code quality indicators are green / good. * [![build status](http://ci.gitlab.org/projects/1/status.png?ref=master)](http://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch) @@ -95,50 +95,71 @@ Make sure the code quality indicators are green / good. * [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) -### 5. Set VERSION +### **5. Set VERSION** Set VERSION tot x.x.0.rc1 -### 6. Tag +### **6. Tag** Create an annotated tag that points to the version change commit. ``` git tag -a vx.x.0.rc1 -m 'Version x.x.0.rc1' ``` -### 7. Tweet +### **7. Tweet** Tweet about the RC release. Make sure to explain what a RC is. -### 8. Update Cloud +### **8. Update Cloud** Merge the RC1 code into Cloud. Once the build is green, deploy in the morning. It is important to do this as soon as possible, so we can catch any errors before we release the full version. -# 22nd - Release +# **22nd - Release** After making the release branch new commits are cherry-picked from master. When the release gets closer we get more selective what is cherry-picked. The days of the month are approximately as follows: -- Create x-x-stable branch and push to the repositories -- QA -- Fix anything coming out of the QA -- Set VERSION to x.x.0 -- Create annotated tag x.x.0 -- Push VERSION + Tag to master, merge into x-x-stable -- Publish blog for new release -- Tweet to blog (see below) +### **1. Create x-x-stable branch and push to the repositories** -# Write a blog post +``` +git checkout master +git pull +git checkout -b x-x-stable +git push x-x-stable +``` + +### **2. Build the Omnibus packages** +[Follow this guide](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md) + +### **3. QA** +Use the omnibus packages to test the following: + +### **4. Fix anything coming out of the QA** + +### **5. Set VERSION to x.x.0** + +### **6. Create annotated tag vx.x.0** +``` +git tag -a vx.x.0 -m 'Version x.x.0' +``` + +### **7. Push VERSION + Tag to master, merge into x-x-stable** +``` +git push origin master +``` + +Next, merge the VERSION into the x-x-stable branch. +### **8. Publish blog for new release** * Mention what GitLab is on the second line: GitLab is open source software to collaborate on code. * Select and thank the the Most Valuable Person (MVP) of this release. * Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible. -# Tweet +### **9. Tweet to blog** Send out a tweet to share the good news with the world. For a major/minor release, list the features in short and link to the blog post. -- GitLab From cc9b7cba3833293fcb25779f1c901e043c4c17d8 Mon Sep 17 00:00:00 2001 From: Alexander Mills Date: Thu, 1 May 2014 15:42:28 +0100 Subject: [PATCH 081/237] Updated CI error message so that it makes more sense --- app/views/projects/merge_requests/show/_mr_ci.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/merge_requests/show/_mr_ci.html.haml b/app/views/projects/merge_requests/show/_mr_ci.html.haml index c175d2f6b40..507a9e507f1 100644 --- a/app/views/projects/merge_requests/show/_mr_ci.html.haml +++ b/app/views/projects/merge_requests/show/_mr_ci.html.haml @@ -26,4 +26,4 @@ .ci_widget.ci-error{style: "display:none"} %i.icon-remove - %strong Cannot connect to CI server. Please check your setting + %strong Cannot connect to the CI server. Please check your settings and try again. -- GitLab From b2a258722bc8afbcca4af6e90cf00e4200cfbf7c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 2 May 2014 13:23:12 +0300 Subject: [PATCH 082/237] Modify release dates for EE and CI Signed-off-by: Dmitriy Zaporozhets --- doc/release/monthly.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/release/monthly.md b/doc/release/monthly.md index 284e4e16595..e47117c7a0d 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -84,8 +84,9 @@ After making the release branch new commits are cherry-picked from master. When - Push VERSION + Tag to master, merge into x-x-stable - Publish blog for new release - Tweet to blog (see below) +* 22th: release GitLab EE * 23nd: optional patch releases (x.x.1, x.x.2, etc., only if there are serious problems) -* 24-end of month: release GitLab EE and GitLab CI +* 25th: release GitLab CI # Write a blog post -- GitLab From c883660a3e754b5a3b14ef4a1be69503d345e3b5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 2 May 2014 13:46:15 +0300 Subject: [PATCH 083/237] Fix install docs for gitlab-shell setup rake task Signed-off-by: Dmitriy Zaporozhets --- doc/install/installation.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index 821ea067e29..90d6f0e17ed 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -27,10 +27,9 @@ The GitLab installation consists of setting up the following components: 1. Packages / Dependencies 2. Ruby 3. System Users -4. GitLab shell -5. Database -6. GitLab -7. Nginx +4. Database +5. GitLab +6. Nginx # 1. Packages / Dependencies @@ -261,7 +260,7 @@ GitLab Shell is an ssh access and repository management software developed speci cd /home/git/gitlab # Run the installation task for gitlab-shell (replace `REDIS_URL` if needed): - sudo -u git -H bundle exec rake gitlab:shell:setup[v1.9.3] REDIS_URL=redis://localhost:6379 + sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.3] REDIS_URL=redis://localhost:6379 # By default, the gitlab-shell config is generated from your main gitlab config. You can review (and modify) it as follows: sudo -u git -H editor /home/git/gitlab-shell/config.yml -- GitLab From dd47f9532ff8015e3d981ba4fd7341b7514ae109 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 2 May 2014 13:46:32 +0300 Subject: [PATCH 084/237] Fix gitlab-shell setup rake task Signed-off-by: Dmitriy Zaporozhets --- lib/tasks/gitlab/shell.rake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 2fcc889d883..00901a89fba 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -11,7 +11,8 @@ namespace :gitlab do gitlab_url = Settings.gitlab.url # gitlab-shell requires a / at the end of the url gitlab_url += "/" unless gitlab_url.match(/\/$/) - target_dir = File.join(home_dir, "gitlab-shell") + repos_path = Gitlab.config.gitlab_shell.repos_path + target_dir = Gitlab.config.gitlab_shell.path # Clone if needed unless File.directory?(target_dir) @@ -28,7 +29,7 @@ namespace :gitlab do user: user, gitlab_url: gitlab_url, http_settings: {self_signed_cert: false}, - repos_path: File.join(home_dir, "repositories"), + repos_path: repos_path, auth_file: File.join(home_dir, ".ssh", "authorized_keys"), redis: { bin: %x{which redis-cli}.chomp, @@ -38,7 +39,7 @@ namespace :gitlab do }, log_level: "INFO", audit_usernames: false - } + }.stringify_keys # Generate config.yml based on existing gitlab settings File.open("config.yml", "w+") {|f| f.puts config.to_yaml} -- GitLab From 87c397f5774c4c11ba2e4c55098920c081e53670 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 2 May 2014 14:13:45 +0300 Subject: [PATCH 085/237] More fixes to gitlab:shell:install Signed-off-by: Dmitriy Zaporozhets --- lib/tasks/gitlab/shell.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake index 00901a89fba..dfc90bb3339 100644 --- a/lib/tasks/gitlab/shell.rake +++ b/lib/tasks/gitlab/shell.rake @@ -4,7 +4,7 @@ namespace :gitlab do task :install, [:tag, :repo] => :environment do |t, args| warn_user_is_not_gitlab - args.with_defaults(tag: "v1.9.1", repo: "https://gitlab.com/gitlab-org/gitlab-shell.git") + args.with_defaults(tag: "v1.9.3", repo: "https://gitlab.com/gitlab-org/gitlab-shell.git") user = Settings.gitlab.user home_dir = Settings.gitlab.user_home @@ -28,7 +28,7 @@ namespace :gitlab do config = { user: user, gitlab_url: gitlab_url, - http_settings: {self_signed_cert: false}, + http_settings: {self_signed_cert: false}.stringify_keys, repos_path: repos_path, auth_file: File.join(home_dir, ".ssh", "authorized_keys"), redis: { @@ -36,7 +36,7 @@ namespace :gitlab do host: redis_url.host, port: redis_url.port, namespace: "resque:gitlab" - }, + }.stringify_keys, log_level: "INFO", audit_usernames: false }.stringify_keys -- GitLab From 02421245256a145a2b29a81f210585b15d1f2b67 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 2 May 2014 14:48:32 +0300 Subject: [PATCH 086/237] Fix 404 on jquery ui images Signed-off-by: Dmitriy Zaporozhets --- Gemfile | 4 +-- Gemfile.lock | 25 ++++++++---------- app/assets/images/ui-icons_222222_256x240.png | Bin 4193 -> 0 bytes app/assets/images/ui-icons_454545_256x240.png | Bin 4193 -> 0 bytes 4 files changed, 13 insertions(+), 16 deletions(-) delete mode 100644 app/assets/images/ui-icons_222222_256x240.png delete mode 100644 app/assets/images/ui-icons_454545_256x240.png diff --git a/Gemfile b/Gemfile index f42d8e2e988..3563dc88e30 100644 --- a/Gemfile +++ b/Gemfile @@ -161,8 +161,8 @@ gem 'jquery-turbolinks' gem 'select2-rails' gem 'jquery-atwho-rails', "~> 0.3.3" -gem "jquery-rails", "2.1.3" -gem "jquery-ui-rails", "2.0.2" +gem "jquery-rails" +gem "jquery-ui-rails" gem "raphael-rails", "~> 2.1.2" gem 'bootstrap-sass', '~> 3.0' gem "font-awesome-rails", '~> 3.2' diff --git a/Gemfile.lock b/Gemfile.lock index dac1844b04b..35645663269 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,7 +34,6 @@ GEM rake (>= 0.8.7) arel (4.0.2) asciidoctor (0.1.4) - atomic (1.1.16) awesome_print (1.2.0) axiom-types (0.0.5) descendants_tracker (~> 0.0.1) @@ -248,15 +247,14 @@ GEM rake jasmine-core (2.0.0.rc5) jquery-atwho-rails (0.3.3) - jquery-rails (2.1.3) - railties (>= 3.1.0, < 5.0) - thor (~> 0.14) + jquery-rails (3.1.0) + railties (>= 3.0, < 5.0) + thor (>= 0.14, < 2.0) jquery-turbolinks (2.0.1) railties (>= 3.1.0) turbolinks - jquery-ui-rails (2.0.2) - jquery-rails - railties (>= 3.1.0) + jquery-ui-rails (4.2.1) + railties (>= 3.2.16) json (1.8.1) jwt (0.1.8) multi_json (>= 1.5) @@ -281,7 +279,7 @@ GEM mime-types (1.25.1) mini_portile (0.5.3) minitest (4.7.5) - multi_json (1.9.2) + multi_json (1.9.3) multi_xml (0.5.5) multipart-post (1.2.0) mysql2 (0.3.11) @@ -376,7 +374,7 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) raindrops (0.12.0) - rake (10.1.1) + rake (10.3.1) raphael-rails (2.1.2) rb-fsevent (0.9.3) rb-inotify (0.9.2) @@ -503,9 +501,8 @@ GEM daemons (>= 1.0.9) eventmachine (>= 1.0.0) rack (>= 1.0.0) - thor (0.18.1) - thread_safe (0.3.1) - atomic (>= 1.1.7, < 2) + thor (0.19.1) + thread_safe (0.3.3) tilt (1.4.1) timers (1.1.0) tinder (1.9.3) @@ -608,9 +605,9 @@ DEPENDENCIES httparty jasmine (= 2.0.0.rc5) jquery-atwho-rails (~> 0.3.3) - jquery-rails (= 2.1.3) + jquery-rails jquery-turbolinks - jquery-ui-rails (= 2.0.2) + jquery-ui-rails kaminari (~> 0.15.1) launchy letter_opener diff --git a/app/assets/images/ui-icons_222222_256x240.png b/app/assets/images/ui-icons_222222_256x240.png deleted file mode 100644 index 8bc06cbf03b830a60f29857361df57214e172dfe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4193 zcmeAS@N?(olHy`uVBq!ia0y~yU}RumVEDkn%)r2K!_(_00|Ud`0G|+76(yCCgFYPY z5Mf|o@GA-O3ucfIFk;~d*xx);Pbs9pAuT~l=q!(djhK^%mt2&ZL6A(btpYd35Bov-qqi;by&anjU<>vQhUb+gN>o0ySt$>T2r1K(9o7srr_ zTW@2zlW%VmWINH3^j|NTEN>CkoL?nBim zBVG3&Pp%8rJg}2%*v;(0J#oT>4a^f1zQ@$xC}cBRH?L*GKOy4<<#N*m(i#^yaz6N~ z_;gpuBVC4VU5(ru9>2C{H|5N0G-I4}y?x4O>kPpI{M+>t-s-TY99XqKy47Ll*##U@ z0xeQUveG5*WbWpj6TKnUwXQjroAX}cZ6+pBiF-_Umaya{UTB(Y9Z~CWf~EaE^Sf%1 z2fi6U0u?NsIHBPCGtPUPZ@b37m$IQj}fg%3eDfS3X#nNw%nuQ?;ln&f#eD8PI zH8ZwBSfTmg;{^vNgw~h$G9T^h>Ee;mQ_^%;!P)Ro%EBVp;h)s$(oc*=C(?Cl3;sXc z(6ajs`-uqQJ6j8W1k1AuLBYF=mv7yfdH=wKiO1J@nCLO(0{4-iIewq~hk@lVn=hon2)=O^GA!zTo{LR;8Ei4sMHPMwp1) z+*+zrHr<|mI;yzaFbb)pCQ zSnofKR$sttUd!Uq(Q^LW%hw4zv&*FRh&{X`xy_@o`%uMur0{ZSs~4b7!q(`u-_5X5AO{i;@=@_GL1g+!4;PlDY8uQCT-bgGcEW zqnXOrn6)QA?B)GvcGJ}GXMxUvTl3f5$l&-C!4SXx!lk{zpBFx~Qz)sv{ldmL?9gw9 zf~Y%ry-f!L58QlunUSgK^pPh0Kd_+cODcz)_SV=x3Ey|+2e^Cj9wo*<}%0@E;z#caAM`cicL(` z3qm>hROX9GY zC;z8U;KP@f!P%92;?txp7^D85H)OoB#Nj2snX9DN?}Nd->se(ouP(GOs%+S^?SCIb zZQYclY`=8B6|)X(PT#?KrezoFtMqb*xcWTLhHL*%zISNkfP3Ej`OSubro@FE_B+ra z$Z&*7&Fwz}ZR5YnJPC?EJSB+X?@e3>WZS zOEC7mvRQMh_Kt0L?)3XLds!Dpnr};=b(?eF^63oIed^z8obCO0%l!SK_?Klz0xbCJ zL*_fjER4DPT;{F+Gq$zI@Bdd>cVvEHO|;fRl}!sioqWM^a@W7hE7vz|DEihYC9}yQ z^k!yS%yG5ki>~2jj5;!GA3wdh`ug%_ru+Y$o+QOG{bQ;Roo^Txu=}6Sv4ibhz3!^t zYZ~U(1eP5})s4ju0J@}}jvQ3_`S${3dnkvQ=#`X{96?_r(Q#N%+9|(Vx{jq#< zkX5=^!8x4=b0QB+IU=`;)nsmn`29_D=Ty`eCAVjhq{*d_#b5EtL?tWAUtV#OuZdXS6bk7&2{N4^Fj`#JMuhrF8R7jj?wO8 zBe?o`$H?mElO4`?&Q(QWzw?v|sYB0S-}(1NQs?SOEAFdpE9w1`>hvELhS2B+t zi!cB1Np+51hx#n;d3hP1dFP%n7di9M@mGKMBi_UX*I)m8+ZZ-?waY~{4Yp}_q~}YY ze;qIN-)!BBO#$jNq7L$Q`pLcycp0n@_KnyAzM*+;t{cw3y)t{25ez|aUl3;F;nz` zl&0&er+2sV>GLvr)d&7CcIfNr*1oe`t?%wx)ywwkmnYx9cKQ4VzMos4R9J8d7p(bb zb1gpiqpR&tD|fL2i>_Z^-yf&{V3GAh>Db*Lzi~Ve`;e>~AN04k>FK6pbL8?kg13Kp z@}xz;;nts+hd#9%S^2&5BxuLk+>+5<~Z9tc&DiGA_w+}Vex zop(6!ybzXMoVVWh-j-jrKcBwpmh9Nhukq<<5+gSUPxEa#R=v`sYggLa^G=_9B3-i4 zt2VWbal@gKzt0_aH}W@cb-nW83uD%m&;u+-WczvlHk`IHom+W{{g0q=s&2l~mpO6= zzIuDczgGG%X=>oQ;HsYPn0zpADyc_0tqkg^_kqGfuYl*W`Ce zbyjzk|K4Zb^S)*N?YQsH_g?%zGwge0_5X!)GntZ^jb}V${`WX4WBcBz>6>T$zd3zOV7L!R6#%Iu-wRn=;g%O}E*`x%Zv*V`;5qk%_Id zqyAa^@<>l-=6B$^#QZ|wm+elAwTD^!drW`zcfJj;__}d#N%<__jdk)@`}xt4QM=8OawO$d>oa8`KVhb#8E4ZDSMG94v}gQgD7mrrl4f2G zy@HGF^-ro(0i%svn+-vkmJ73-7NEd&XbU#z`zWDq! zk-V&eyIt3nF0fa)9awvJ+V3yjbr&-uE54tuy{5P~(NGaonDz%adhGe^SRTW9`uxt| z@Gl>ePtWD+aIQE!g~`bwcG^SPRfWsy8J@1MKIkB96`ovQ5p8&X=ccZO^Ax3xhH!?DSxwb&i40nGCoddJHFgd zFfoIPZA-&e4v8B~ZEu-lG+V3RGPB9CzNtBG+s{<}o?Qh5-k2w>pTGFjKkWzCH}_a* ziC2G_7xPy}^H0>m=aQ#h&3(++b|Z=c*X zZqQb&TYE&b?pBp$xS($BzH1srR+1~%=lwLBbK&coC^oJBFX>wrzsubhWnQ27F2Is? z@2!6qoE`pVnN+Im-u||6N|m#={LB8z|MT?1qn`-A*}$q1^U!+T?^e}-uhvZavMmM)59J!{1f!^?fSw<1?e-O#Q{LwZHGZx2)*PzuBct%U_?UQA~~B`Tncf)Wr|Z zv)34?XFSb*D;>A~$?SKrnP-D;NpH5F)Vlpov*!N?d-pXY{9JSL)`Oyhuk}BC<~x`p z5iN6e`nhZS*RB8frXZ(&_nlk!eJ1Wc_3_Qj-{up3b=7&t7%vqoNawjI$xbN=3DuybAFTJ=a+BV zvghe>_19(&^UFCBUnJ&SPTaCy=Juu<~hO__%>%#edsqhcuQ(h3=KPk}jJXuCUvvFny~P0fnuH zhsO=GCx<_>ELyFg_Ib eJ7L4)AND7o70WawI;4X}5IkM|T-G@yGywqWI*#%H diff --git a/app/assets/images/ui-icons_454545_256x240.png b/app/assets/images/ui-icons_454545_256x240.png deleted file mode 100644 index cfd1eaffaae0f5fe30d8e86d2e54b990d2a1ccd0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4193 zcmeAS@N?(olHy`uVBq!ia0y~yU}RumVEDkn%)r2K!_(_00|Ud`0G|+77dMxYgXDAn zTQM*&_>~0t1v5wp7_o2!>~Ef_rxa4)kd`1Nbe2cKM$E~>OD;;yAV{axq`mQQ*2(k7 zEnH;w?yOn8b!qR)wVO5m&R2QQ#m3aXIBDv_^*Q(Fy4mH`P0Yx+>}K}ho;YE`2IdJ0-(%`;6tbDEo7b}8pOEo_a=B>&X^jgUIUjsg ze7Y;-kuJlwu14++k6+ufn{wtgnlVng-ah5Cb%x*p{_Xk+Z*|yH4y@WA-RiLO>;euc zfflJFS?Q8@GI#UNiQW+FTGyP*&3P~JHWQPm#66}vOIY#}FEq`yj;M7w!P5So`CYZh z1K*4vfeMyRoKW!n8Rxyt@+xaHcz1l(W9DM~z!3lK6ng}xV(B+W&BBlaN(XK=zV|!q zni<<5tk8V$@q&XBLhH+WnUD7Mbn(dODQP;a;B0s(WnmHQ@K5S==_f{`6X`m&1^*vz zXxV*+{X~TDovj5wg5_C-py1ub%eU^#y#L})!G5kA3;hEYMzeTbc>l|6p@5}y%k~?u zHYRN-U)bKf{!DFS0;|l@hp%^^6Hq##wcU@+kjb;P;VomI@U5?m>zf|zihJ>^YzL1a zlY&HkbH|6*RyG^BLkqT=S8y^V&NVnO|8|G7nn;d=A9rGpH6Q=%j6YnpSGu{|KzQ+?Lfj8eBTxNavu=s$iyu7@cFvOMLL}%-J-@R~lLf_RF|AKe@x$q(+ z^vS2cS{tsh9{OmrCXg{i@57TTQgL(dNir?$&aSebro<6N)L5d(kZBGK(Qw>7v?$yr-9T zw{Mxg=LQ$ct&YP7B80`S@zl03NS9Qe%`^OMIaUiaFJI?)4t ztoI*At1sX+uVwM*XgPoGMky8_&0Do z@J)LCaPG@1B}NCk&b|2jx38#PxO|4o2f;hsLyej_3W8 z=1&IsV#0>t6LLQso)uUtn8Y64`|$RQ{ocWh=Q71!)uvv&>2SiuKi~h|D%O&Z(-x{X z^RPOb>^r?+Bf|lfHhIg2xwF3pvq0y-t@-P2WN>_nV2EFT;nLpV&kG;gDU?*-eqm!AcIY=l zLDZeR-ll_r2W~#S%*fPq`bd-h@(P7Ihc7HQfBin?Z}98=;(8}1C#OSoir4F$_Wk?U z@5a^Nwkmd^mbso&b&c4^I}ZvUYdux`TUaRf?D0emMz4<@a~Wg{7aU=JII(hJ#U>`} z1)-dLt5-Rki~C!ixO12A|I1e{Pi+fclpmg~7i}EPzWUR)Ym0^4lr`MX_%hdjN%M~l zI-d7vSCaUW(9o%-2`xRGj2(;@)U25D7%!ijY!~z*CNo3#fcgEqbI#2vU|Ib5v5W!Z z=9@ZySlSp0xcr#-I2sp(x=V{F3JG5dnIKfR=;3At4Tis$#N)m)HfVWd)db1cC2?5H zlmF8v@ZrnL;Oxph@oCZ)j8Xs38!}#5;_#B+%vI9s_rYM^^{g_PR~K3sRW|I|_P>vz zwr)yNwqLs6idhFXr|;lA)3S^8ReHHYTz#Hr!?ph>Up}v6Qn|fgn@6QeAP4j3pLg!F zADEcr@UowC#eOTMSAGJ51I zWH`d4=Jua~@$SogYYzJ4nS6?Ls0&eM@8{XouiLQY@bcK%z6?Sy|!h70(v zB^di&*{r!$d&jmrcl!OBy{wBP&9|k`y3M(7`E-WqKJ{-k&i4MhW&VCq{L8W<0T%rA zA@iMM7RKCtF7wv^8Qa?9_y4P`J2JnpCR%Hu%BBUMPQG9{x$EEMmFt@}6n$%ylG$Vt zdNVUE=D1q&Mb~gMMjaWpkDuOLeSLW|)BXQWPm*Gp{xQ{u&NmDT*!|Dv*unO$UU${+ zwTxR6_Bgf1zOU3?RF}Zh9(>eM*(T4}tiP6JO%-DbWBUj53ciT?DVw^Z4}?F;{#ZUa z$SPf|;GE8bIgtmZ9FbeaYBD!O{QjobwU<5amx!)uu9UHEc*lGp>!${z{`q|t0rK1b zY5U6xPjH-Dn)P)3gXph6*`o{{Z&m0%_i=k#`a9I(gTMv1a>-n!D|JkJZF;y2)jujJ zE2Q%n|J^MrIE6uFe(m3qKVRnGU;9LPf#<~;HcQLT=P_wZc2A$~c5U1Jr`B^>A{H;O zautGM$Qe_q-V5D&U*KzBr($9?^^~t6E@BI5BsdM$bs@yF74_A&n4-m2c!*GA$E15@+ z#g~8hq&i2hLwy$ayu6IhymQZ(i=6rB_^ZGB5pUvx>#zU4Z48^c+U25}2HUhd((|Ry zzmAvsZ?^8mrU3OBQ3rWD{bXMUyo_0Q(|u>(POh>uPZEL?nzY|a=s)Dm>1BAEwNQD> zyRYV^49*8`Z+F^LoBb-7W5u$Hw02>KX*~{edz`rCj4m$GGJ2f-+)BQgqhjszS07lX z&nlH?ocQ(2w~#Q-Exx+hl_#6UUscaOdA+=H~imJM{H*Yu{O})_3=;>ScTN%aiY4yL|ow-_Na2Dl9mK3)cLz zxfY-M(be{+mAlx1Mc1#d?~l`eu*mwMbnNbr-#8wKeMr`g5Bl5N^mNm)IdXX%!P~z) zdD0@_aO+RZL!a7>to+{j@*5&vur*j8G1-?(DG&OKtaMe$bJJ8<^v$#W-<-g< zK<4Z<7CQ+hyB{)&)8zvtz1FN`-`9BB;BxXWor-_EO&My>rrT`e-22Y@v9wmQ$i&v! zQU5G{d8DT^^E>cdVtyg;%XX*5+QTgVJ*L0H~xx}T|eUwnR= zNM2UK-LC6O7uYM@4y?U9?e~}Nx{H~S72i+SUQ^tgXs8G(O#1^IJ@$NdERW$leST+f z_?M5#r|0r@I9D8=!sO%-JME$Ds={UU3{TfrA9N753Qw-Dh&H^xb5qyCd5Y3Taw;ML zOtUtvJNNZ%;H!_a9E>~es2%vaWWDa84J;3i9+=Z$^>^c{l)u?IXZ!m(86PLK9baxJ zn3%!DwxwY!hr|u0wzteNnyuAunc3u6-_#tp?Pscf&#nRjZ_E?c&tH7%pZ0_6n|my@ z#H+u|i}@>~`6p`ObIDV$=00ZZx@P|Hz5NUA_cGHy*t<43te$MDo!rg%I`z}fw@>aG zH)t!?tvw=IcdN=WTu`@m-!%;*E6J7X^M0Dmx$yN(6q{E6m-H=*-{tO$GOtg37huV{ z_tw7)&JKUGOe$4&Z-3i3rOH`b{$+pV|9N`h(N6^5Y+%)hd1$@vcdKf^S8Jwy*%xM3 z_*XtRSaf#6I z*=r2cGoEI@m5y8gWcIt*%(Fqaq&M47YTf>)S@Zvcz55yxey%xr>p{`M*ZLnm^Bv5Q zh?Y4!{oJ+v>(+mKQ;<`?`_8TVJ`;DJ`uJw%Z}SPiI_}r~_Py}yioeQwZ-$?T6<=Sg zKC7jpuwnlO5w7>=IXbSf@3*_BsxS3-yZZr=z0Kzw8(x>ow=TL~9^r9<>C0_5u?x)& z6~Y(t@4rfZv{8-8kg3_%YljZk`~4YT;`@cqU z&bc5zyZiKf1x5k21^*^+Sot(CeB8jX;=gUQLmEq?LifsCNtaCxSJ-V-n7-ADfWp?p z!{dh8lfxfb7OhrLe82xf=%)YtTP}b1I?>Dd;QMdIm-~6SAN;b@_`8zz%IVv$``a0= z|Che-yZEpDO*@5r$FI|;{VU4XS#b0J!&m!Pvf5PqHJ4?z`SpIae8QLiEq@x~a=bpz dov`8Y5BrnPie;J-9nwJ~2%fHfF6*2Ung9)ptwaC- -- GitLab From d10b34a685509eebbe52391ffce861cde45cc0ca Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 2 May 2014 16:05:08 +0300 Subject: [PATCH 087/237] Save repository size to projects table Signed-off-by: Dmitriy Zaporozhets --- app/helpers/projects_helper.rb | 2 +- app/models/project.rb | 4 ++++ app/services/git_push_service.rb | 1 + .../20140502115131_add_repo_size_to_db.rb | 5 +++++ .../20140502125220_migrate_repo_size.rb | 21 +++++++++++++++++++ db/schema.rb | 3 ++- 6 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20140502115131_add_repo_size_to_db.rb create mode 100644 db/migrate/20140502125220_migrate_repo_size.rb diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 9bb3efc41d8..ef0460f8728 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -163,7 +163,7 @@ module ProjectsHelper end def repository_size(project = nil) - "#{(project || @project).repository.size} MB" + "#{(project || @project).repository_size} MB" rescue # In order to prevent 500 error # when application cannot allocate memory diff --git a/app/models/project.rb b/app/models/project.rb index 3ae47c18136..45aeaceef83 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -562,4 +562,8 @@ class Project < ActiveRecord::Base def forked_from?(project) forked? && project == forked_from_project end + + def update_repository_size + update_attribute(:repository_size, repository.size) + end end diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index 351b446457d..715b5690751 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -25,6 +25,7 @@ class GitPushService project.ensure_satellite_exists project.repository.expire_cache + project.update_repository_size if push_to_existing_branch?(ref, oldrev) project.update_merge_requests(oldrev, newrev, ref, @user) diff --git a/db/migrate/20140502115131_add_repo_size_to_db.rb b/db/migrate/20140502115131_add_repo_size_to_db.rb new file mode 100644 index 00000000000..7361d1a9440 --- /dev/null +++ b/db/migrate/20140502115131_add_repo_size_to_db.rb @@ -0,0 +1,5 @@ +class AddRepoSizeToDb < ActiveRecord::Migration + def change + add_column :projects, :repository_size, :float, default: 0 + end +end diff --git a/db/migrate/20140502125220_migrate_repo_size.rb b/db/migrate/20140502125220_migrate_repo_size.rb new file mode 100644 index 00000000000..eed6d366814 --- /dev/null +++ b/db/migrate/20140502125220_migrate_repo_size.rb @@ -0,0 +1,21 @@ +class MigrateRepoSize < ActiveRecord::Migration + def up + Project.reset_column_information + Project.find_each(batch_size: 500) do |project| + begin + if project.empty_repo? + print '-' + else + project.update_repository_size + print '.' + end + rescue + print 'F' + end + end + puts 'Done' + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index a26c60874a3..93837337afc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140428105831) do +ActiveRecord::Schema.define(version: 20140502125220) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -222,6 +222,7 @@ ActiveRecord::Schema.define(version: 20140428105831) do t.integer "visibility_level", default: 0, null: false t.boolean "archived", default: false, null: false t.string "import_status" + t.float "repository_size", default: 0.0 end add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree -- GitLab From c608a5dceab0a5fa2df8286d5808091f2517d4ab Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 2 May 2014 17:02:57 +0300 Subject: [PATCH 088/237] Add sort dropdown for admin projects page Signed-off-by: Dmitriy Zaporozhets --- app/controllers/admin/projects_controller.rb | 1 + app/models/project.rb | 1 + app/views/admin/projects/index.html.haml | 23 ++++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 13a7bdcf34a..92ef5963373 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -12,6 +12,7 @@ class Admin::ProjectsController < Admin::ApplicationController @projects = @projects.with_push if params[:with_push].present? @projects = @projects.abandoned if params[:abandoned].present? @projects = @projects.search(params[:name]) if params[:name].present? + @projects = @projects.sort(@sort = params[:sort]) @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) end diff --git a/app/models/project.rb b/app/models/project.rb index 45aeaceef83..7ddcc73cf2a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -203,6 +203,7 @@ class Project < ActiveRecord::Base when 'oldest' then reorder('projects.created_at ASC') when 'recently_updated' then reorder('projects.updated_at DESC') when 'last_updated' then reorder('projects.updated_at ASC') + when 'largest_repository' then reorder('projects.repository_size DESC') else reorder("namespaces.path, projects.name ASC") end end diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index 296094ab29c..51ad702154f 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -32,6 +32,7 @@ = visibility_level_icon(level) = label .form-actions + = hidden_field_tag :sort, params[:sort] = submit_tag "Search", class: "btn submit btn-primary" = link_to "Reset", admin_projects_path, class: "btn" @@ -40,6 +41,28 @@ .title Projects (#{@projects.total_count}) .pull-right + .dropdown.inline + %a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"} + %span.light sort: + - if @sort.present? + = @sort.humanize + - else + Name + %b.caret + %ul.dropdown-menu + %li + = link_to admin_projects_path(sort: nil) do + Name + = link_to admin_projects_path(sort: 'newest') do + Newest + = link_to admin_projects_path(sort: 'oldest') do + Oldest + = link_to admin_projects_path(sort: 'recently_updated') do + Recently updated + = link_to admin_projects_path(sort: 'last_updated') do + Last updated + = link_to admin_projects_path(sort: 'largest_repository') do + Largest repository = link_to 'New Project', new_project_path, class: "btn btn-new" %ul.well-list - @projects.each do |project| -- GitLab From 993fc8485518e53b7b868b47a622455b01d741a1 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 2 May 2014 22:00:23 +0300 Subject: [PATCH 089/237] Use sign icon style for help link Signed-off-by: Dmitriy Zaporozhets --- app/views/layouts/_head_panel.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index f1545c6d089..bf37e708206 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -22,7 +22,7 @@ %li = link_to help_path, title: 'Help', class: 'has_bottom_tooltip', 'data-original-title' => 'Help' do - %i.icon-question + %i.icon-question-sign %li = link_to public_root_path, title: "Public area", class: 'has_bottom_tooltip', 'data-original-title' => 'Public area' do %i.icon-globe -- GitLab From d210484205c51e12e63ea0ad20cd10b7ef3f7057 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Fri, 2 May 2014 17:14:58 -0500 Subject: [PATCH 090/237] Fix mobile menu after adding help link --- app/views/layouts/_head_panel.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml index bf37e708206..fba56b5dc3b 100644 --- a/app/views/layouts/_head_panel.html.haml +++ b/app/views/layouts/_head_panel.html.haml @@ -43,6 +43,6 @@ %li = link_to destroy_user_session_path, class: "logout", method: :delete, title: "Logout", class: 'has_bottom_tooltip', 'data-original-title' => 'Logout' do %i.icon-signout - %li + %li.hidden-xs = link_to current_user, class: "profile-pic", id: 'profile-pic' do = image_tag avatar_icon(current_user.email, 26), alt: 'User activity' -- GitLab From cac61501fd5d21eb7e4d8e494c3ea9d7d4e35005 Mon Sep 17 00:00:00 2001 From: dosire Date: Sat, 3 May 2014 11:03:34 +0200 Subject: [PATCH 091/237] Add command line client information and fix link to ee. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f3453a267a..cb755a411e8 100644 --- a/README.md +++ b/README.md @@ -29,11 +29,11 @@ * [GitLab.com](https://www.gitlab.com/) includes information about [subscriptions](https://www.gitlab.com/subscription/), [consultancy](https://www.gitlab.com/consultancy/), the [community](https://www.gitlab.com/community/) and the [hosted GitLab Cloud](https://www.gitlab.com/cloud/). -* [GitLab Enterprise Edition](https://www.gitlab.com/gitlab-ce/) offers additional features that are useful for larger organizations (100+ users). +* [GitLab Enterprise Edition](https://www.gitlab.com/gitlab-ee/) offers additional features aimed at larger organizations. * [GitLab CI](https://www.gitlab.com/gitlab-ci/) is a continuous integration (CI) server that is easy to integrate with GitLab. -* Unofficial third-party [iPhone app](http://gitlabcontrol.com/) and [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) for GitLab +* Unofficial third-party [iPhone app](http://gitlabcontrol.com/)m [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) and [command line client](https://github.com/drewblessing/gitlab-cli) for GitLab. ### Requirements -- GitLab From db7f07387fed8f4dd1ad321e6e5c46fad6d44b45 Mon Sep 17 00:00:00 2001 From: Job van der Voort Date: Mon, 5 May 2014 08:09:46 +0200 Subject: [PATCH 092/237] add ee, ci and patch release --- doc/release/monthly.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/release/monthly.md b/doc/release/monthly.md index 2bd1b2f4f4e..8c3a432d25d 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -118,7 +118,7 @@ Merge the RC1 code into Cloud. Once the build is green, deploy in the morning. It is important to do this as soon as possible, so we can catch any errors before we release the full version. -# **22nd - Release** +# **22nd - Release CE** After making the release branch new commits are cherry-picked from master. When the release gets closer we get more selective what is cherry-picked. The days of the month are approximately as follows: @@ -168,4 +168,8 @@ For a RC, make sure to explain what a RC is. A patch release tweet should specify the fixes it brings and link to the corresponding blog post. +# **22nd - Release EE** +# **23rd - Optional Patch Release** + +# **25th - Release GitLab CI** -- GitLab From 73801a746362e4c284f323e415c1853eed77ba56 Mon Sep 17 00:00:00 2001 From: Marc Radulescu Date: Mon, 5 May 2014 10:04:52 +0200 Subject: [PATCH 093/237] added database requirements in documentation --- doc/install/requirements.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/install/requirements.md b/doc/install/requirements.md index 62e21dc72bb..0fe015b2d34 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -74,6 +74,9 @@ Apart from a local hard drive you can also mount a volume that supports the netw If you have enough RAM memory and a recent CPU the speed of GitLab is mainly limited by hard drive seek times. Having a fast drive (7200 RPM and up) or a solid state drive (SSD) will improve the responsiveness of GitLab. +## Database + +If you want to run the database separately, the **recommended** database size is **1 MB per user** # Supported webbrowsers -- GitLab From 4146e885dde2338b25c1a176ede2f5a2d0946f96 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 5 May 2014 11:55:49 +0200 Subject: [PATCH 094/237] Fix styling issues. --- app/controllers/projects/wikis_controller.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index 0eb9364eaa4..496064c9a65 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -12,19 +12,21 @@ class Projects::WikisController < Projects::ApplicationController def show @page = @project_wiki.find_page(params[:id], params[:version_id]) + gollum_wiki = @project_wiki.wiki + file = gollum_wiki.file(params[:id], gollum_wiki.ref, true) if @page render 'show' - elsif file = @project_wiki.wiki.file(params[:id], @project_wiki.wiki.ref, true) + elsif file if file.on_disk? - send_file file.on_disk_path, :disposition => 'inline' + send_file file.on_disk_path, disposition: 'inline' else - send_data( - file.raw_data, - type: file.mime_type, - disposition: 'inline', - filename: file.name - ) + send_data( + file.raw_data, + type: file.mime_type, + disposition: 'inline', + filename: file.name + ) end else return render('empty') unless can?(current_user, :write_wiki, @project) -- GitLab From ad0f5fdc2729ac26268c2638c064abbf14134688 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Thu, 27 Mar 2014 17:05:15 -0500 Subject: [PATCH 095/237] Improve mobile UI for issues and merge requests --- CHANGELOG | 1 + app/assets/stylesheets/generic/issue_box.scss | 19 ++++++++- app/assets/stylesheets/sections/issues.scss | 33 +++++++++++++++ app/assets/stylesheets/sections/votes.scss | 6 +++ .../projects/issues/_issue_context.html.haml | 40 ++++++++++--------- app/views/projects/issues/show.html.haml | 31 +++++++------- .../merge_requests/show/_context.html.haml | 40 ++++++++++--------- .../merge_requests/show/_mr_box.html.haml | 6 +-- .../merge_requests/show/_mr_title.html.haml | 2 +- 9 files changed, 119 insertions(+), 59 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1e9aeefd19a..d3561d2efc9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ v 6.9.0 - Fix syntax highlighting for code comments blocks - Improve comments loading logic - Stop refreshing comments when the tab is hidden + - Improve issue and merge request mobile UI (Drew Blessing) v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion diff --git a/app/assets/stylesheets/generic/issue_box.scss b/app/assets/stylesheets/generic/issue_box.scss index 3db4d908d9c..ccdcc657946 100644 --- a/app/assets/stylesheets/generic/issue_box.scss +++ b/app/assets/stylesheets/generic/issue_box.scss @@ -70,7 +70,6 @@ } .state { - height: 34px; border-bottom: 1px solid #DDD; line-height: 32px; } @@ -89,6 +88,18 @@ border: none; border-top: 1px solid #eee; padding: 15px 25px; + + // Reset text align for children + .text-right > * { text-align: left; } + + @media (max-width: $screen-xs-max) { + // Don't right align on mobile + .text-right { text-align: left; } + + .row .col-md-6 { + padding-top: 5px; + } + } } .description { @@ -106,7 +117,11 @@ padding: 1px 25px; text-align: center; text-shadow: none; - margin-right: 20px; display: inline-block; + line-height: 34px; + } + + .creator { + padding: 2px 15px; } } diff --git a/app/assets/stylesheets/sections/issues.scss b/app/assets/stylesheets/sections/issues.scss index d4f8c8108ab..3c48361b2ec 100644 --- a/app/assets/stylesheets/sections/issues.scss +++ b/app/assets/stylesheets/sections/issues.scss @@ -143,3 +143,36 @@ form.edit-issue { border-color: #E5E5E5; } } + +@media (max-width: $screen-xs-max) { + .issue-btn-group { + width: 100%; + margin-top: 5px; + + .btn-group { + width: 100%; + + ul { + width: 100%; + text-align: center; + } + } + + .btn { + width: 100%; + margin-top: -1px; + + &:first-child:not(:last-child) { + border-radius: 4px 4px 0 0; + } + + &:not(:first-child):not(:last-child) { + border-radius: 0; + } + + &:last-child:not(:first-child) { + border-radius: 0 0 4px 4px; + } + } + } +} diff --git a/app/assets/stylesheets/sections/votes.scss b/app/assets/stylesheets/sections/votes.scss index 13f811e01a1..d683e33e1f0 100644 --- a/app/assets/stylesheets/sections/votes.scss +++ b/app/assets/stylesheets/sections/votes.scss @@ -40,4 +40,10 @@ .votes-holder { float: right; width: 250px; + + @media (max-width: $screen-xs-max) { + width: 100%; + margin-top: 5px; + margin-bottom: 10px; + } } diff --git a/app/views/projects/issues/_issue_context.html.haml b/app/views/projects/issues/_issue_context.html.haml index aae101cf40f..425dcb45ddf 100644 --- a/app/views/projects/issues/_issue_context.html.haml +++ b/app/views/projects/issues/_issue_context.html.haml @@ -1,22 +1,24 @@ = form_for [@project, @issue], remote: true, html: {class: 'edit-issue inline-update'} do |f| - %strong.append-right-10 - Assignee: + .row + .col-md-6 + %strong.append-right-10 + Assignee: - - if can?(current_user, :modify_issue, @issue) - = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @issue.assignee_id) - - elsif issue.assignee - = link_to_member(@project, @issue.assignee) - - else - None + - if can?(current_user, :modify_issue, @issue) + = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @issue.assignee_id) + - elsif issue.assignee + = link_to_member(@project, @issue.assignee) + - else + None - .pull-right - %strong.append-right-10 - Milestone: - - if can?(current_user, :modify_issue, @issue) - = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone (none):" }, {class: 'select2 select2-compact'}) - = hidden_field_tag :issue_context - = f.submit class: 'btn' - - elsif issue.milestone - = link_to issue.milestone.title, project_milestone_path - - else - None + .col-md-6.text-right + %strong.append-right-10 + Milestone: + - if can?(current_user, :modify_issue, @issue) + = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2 select2-compact'}) + = hidden_field_tag :issue_context + = f.submit class: 'btn' + - elsif issue.milestone + = link_to issue.milestone.title, project_milestone_path + - else + None diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index 124eb53571d..b6d3a8edf4d 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -1,7 +1,7 @@ %h3.page-title Issue ##{@issue.iid} - %span.pull-right + %span.pull-right.issue-btn-group - if can?(current_user, :write_issue, @project) = link_to new_project_issue_path(@project), class: "btn btn-grouped", title: "New Issue", id: "new_issue_link" do %i.icon-plus @@ -16,28 +16,29 @@ %i.icon-edit Edit -.votes-holder - #votes= render 'votes/votes_block', votable: @issue +.clearfix + .votes-holder + #votes= render 'votes/votes_block', votable: @issue -.back-link - = link_to project_issues_path(@project) do - ← To issues list - %span.milestone-nav-link - - if @issue.milestone - | - %span.light Milestone - = link_to project_milestone_path(@project, @issue.milestone) do - = @issue.milestone.title + .back-link + = link_to project_issues_path(@project) do + ← To issues list + %span.milestone-nav-link + - if @issue.milestone + | + %span.light Milestone + = link_to project_milestone_path(@project, @issue.milestone) do + = @issue.milestone.title .issue-box{ class: issue_box_class(@issue) } - .state - %span.state-label + .state.clearfix + .state-label.col-sm-2.col-xs-12 - if @issue.closed? Closed - else Open - %span.creator + %span.creator.col-sm-9.col-xs-12 Created by #{link_to_member(@project, @issue.author)} #{time_ago_with_tooltip(@issue.created_at)} %h4.title diff --git a/app/views/projects/merge_requests/show/_context.html.haml b/app/views/projects/merge_requests/show/_context.html.haml index 2bd850426a9..5c6734fd24b 100644 --- a/app/views/projects/merge_requests/show/_context.html.haml +++ b/app/views/projects/merge_requests/show/_context.html.haml @@ -1,22 +1,24 @@ = form_for [@project, @merge_request], remote: true, html: {class: 'edit-merge_request inline-update'} do |f| - %strong.append-right-10 - Assignee: + .row + .col-md-6 + %strong.append-right-10 + Assignee: - - if can?(current_user, :modify_merge_request, @merge_request) - = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @merge_request.assignee_id) - - elsif merge_request.assignee - = link_to_member(@project, @merge_request.assignee) - - else - None + - if can?(current_user, :modify_merge_request, @merge_request) + = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @merge_request.assignee_id) + - elsif merge_request.assignee + = link_to_member(@project, @merge_request.assignee) + - else + None - .pull-right - %strong.append-right-10 - Milestone: - - if can?(current_user, :modify_merge_request, @merge_request) - = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone (none):" }, {class: 'select2 select2-compact'}) - = hidden_field_tag :merge_request_context - = f.submit class: 'btn' - - elsif merge_request.milestone - = link_to merge_request.milestone.title, project_milestone_path - - else - None + .col-md-6.text-right + %strong.append-right-10 + Milestone: + - if can?(current_user, :modify_merge_request, @merge_request) + = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2 select2-compact'}) + = hidden_field_tag :merge_request_context + = f.submit class: 'btn' + - elsif merge_request.milestone + = link_to merge_request.milestone.title, project_milestone_path + - else + None diff --git a/app/views/projects/merge_requests/show/_mr_box.html.haml b/app/views/projects/merge_requests/show/_mr_box.html.haml index 8855982a2e7..435e916c6dc 100644 --- a/app/views/projects/merge_requests/show/_mr_box.html.haml +++ b/app/views/projects/merge_requests/show/_mr_box.html.haml @@ -1,6 +1,6 @@ .issue-box{ class: issue_box_class(@merge_request) } - .state - %span.state-label + .state.clearfix + %span.state-label.col-sm-2.col-xs-12 - if @merge_request.merged? Merged - elsif @merge_request.closed? @@ -8,7 +8,7 @@ - else Open - %span.creator + %span.creator.col-sm-9.col-xs-12 Created by #{link_to_member(@project, @merge_request.author)} #{time_ago_with_tooltip(@merge_request.created_at)} %h4.title diff --git a/app/views/projects/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml index 7676fc137c7..8f78e93df4f 100644 --- a/app/views/projects/merge_requests/show/_mr_title.html.haml +++ b/app/views/projects/merge_requests/show/_mr_title.html.haml @@ -1,7 +1,7 @@ %h3.page-title = "Merge Request ##{@merge_request.iid}" - %span.pull-right + %span.pull-right.issue-btn-group - if can?(current_user, :modify_merge_request, @merge_request) - if @merge_request.open? .btn-group.pull-left -- GitLab From cac916d974cf12083002d01488dfd3ca8ac2a89a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 5 May 2014 14:21:00 +0300 Subject: [PATCH 096/237] Clean working directory in satellite Signed-off-by: Dmitriy Zaporozhets --- lib/gitlab/satellite/satellite.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb index c6e4d3351cf..05123ad9c41 100644 --- a/lib/gitlab/satellite/satellite.rb +++ b/lib/gitlab/satellite/satellite.rb @@ -84,6 +84,7 @@ module Gitlab # Clear the working directory def clear_working_dir! repo.git.reset(hard: true) + repo.git.clean(f: true, d: true, x: true) end # Deletes all branches except the parking branch -- GitLab From 4f670fbe9c83bdf20e1a58d3166848ab6d453b6c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 5 May 2014 14:30:50 +0300 Subject: [PATCH 097/237] Create seed projects with different visibility Signed-off-by: Dmitriy Zaporozhets --- db/fixtures/development/04_project.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/fixtures/development/04_project.rb b/db/fixtures/development/04_project.rb index 9303ab93300..164bb637809 100644 --- a/db/fixtures/development/04_project.rb +++ b/db/fixtures/development/04_project.rb @@ -40,7 +40,8 @@ Gitlab::Seeder.quiet do import_url: url, namespace_id: group.id, name: project_path.titleize, - description: Faker::Lorem.sentence + description: Faker::Lorem.sentence, + visibility_level: Gitlab::VisibilityLevel.values.sample } project = Projects::CreateService.new(User.first, params).execute -- GitLab From dc1eff9b91343d8b1cb06b05b5f72dcec1cef860 Mon Sep 17 00:00:00 2001 From: Job van der Voort Date: Mon, 5 May 2014 13:34:43 +0200 Subject: [PATCH 098/237] remove redundancy, remove really good joke, add step to release --- doc/release/monthly.md | 45 +++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/doc/release/monthly.md b/doc/release/monthly.md index b9c39ba3236..44802c347f0 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -1,19 +1,6 @@ # Monthly Release NOTE: This is a guide for GitLab developers. If you are trying to install GitLab see the latest stable [installation guide](install/installation.md) and if you are trying to upgrade, see the [upgrade guides](update). -# Release Schedule - -After making the release branch new commits are cherry-picked from master. When the release gets closer we get more selective what is cherry-picked. The days of the month are approximately as follows: - -* 1-7th: Official merge window (see contributing guide). -* 8-14th: Work on bugfixes, sponsored features and GitLab EE. -* 15th: Code freeze -* 18th: Release Candidate 1 -* 20st: Optional release candidate 2 -* 22nd: Release -* 23nd: Optional patch releases -* 24-end of month: Release GitLab EE and GitLab CI - # **15th - Code Freeze & Release Manager** ### **1. Stop merging in code, except for important bugfixes** @@ -24,8 +11,6 @@ A release manager is selected that coordinates the entire release of this versio # **18th - Releasing RC1** -> Yo dawg, I heard you like releases.. - The RC1 release comes with the task to update the installation and upgrade docs. Be mindful that there might already be merge requests for this on GitLab or GitHub. ### **1. Create an issue for RC1 release** @@ -118,9 +103,13 @@ Merge the RC1 code into Cloud. Once the build is green, deploy in the morning. It is important to do this as soon as possible, so we can catch any errors before we release the full version. -# **22nd - Release CE** +# **22nd - Release** -After making the release branch new commits are cherry-picked from master. When the release gets closer we get more selective what is cherry-picked. The days of the month are approximately as follows: +For GitLab EE, append -ee to the branches and tags. + +`x-x-stable-ee` + +`v.x.x.0-ee` ### **1. Create x-x-stable branch and push to the repositories** @@ -135,7 +124,8 @@ git push x-x-stable [Follow this guide](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md) ### **3. QA** -Use the omnibus packages to test the following: +Use the omnibus packages to test using [this guide](https://dev.gitlab.org/gitlab/gitlab-ee/blob/master/doc/release/manual_testing.md) + ### **4. Fix anything coming out of the QA** @@ -153,21 +143,22 @@ git push origin master Next, merge the VERSION into the x-x-stable branch. -### **8. Publish blog for new release** -* Mention what GitLab is on the second line: GitLab is open source software to collaborate on code. -* Select and thank the the Most Valuable Person (MVP) of this release. -* Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible. +### **8. Push to remotes** -### **9. Tweet to blog** +For GitLab CE, push to dev, GitLab.com and GitHub. -Send out a tweet to share the good news with the world. For a major/minor release, list the features in short and link to the blog post. +For GitLab EE, push to the subscribers repo. -For a RC, make sure to explain what a RC is. +NOTE: You might not have the rights to push to master on dev. Ask Dmitriy. -A patch release tweet should specify the fixes it brings and link to the corresponding blog post. +### **9. Publish blog for new release** +* Mention what GitLab is on the second line: GitLab is open source software to collaborate on code. +* Select and thank the the Most Valuable Person (MVP) of this release. +* Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible. +### **10. Tweet to blog** -# **22nd - Release EE** +Send out a tweet to share the good news with the world. List the features in short and link to the blog post. # **23rd - Optional Patch Release** -- GitLab From 5a949e609512cdabd7885712a37e04095d1f4600 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 5 May 2014 13:47:47 +0200 Subject: [PATCH 099/237] Add tests for wiki files showing. --- features/project/wiki.feature | 17 +++++++++++++++ features/steps/project/wiki.rb | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/features/project/wiki.feature b/features/project/wiki.feature index 90eb2b79c66..41c51f2c42e 100644 --- a/features/project/wiki.feature +++ b/features/project/wiki.feature @@ -45,3 +45,20 @@ Feature: Project Wiki And I browse to that Wiki page And I click on the "Pages" button Then I should see the existing page in the pages list + + Scenario: Image in wiki repo shown on the page + Given I have an existing Wiki page with images linked on page + And I browse to wiki page with images + Then Image should be shown on the page + + Scenario: File does not exist in wiki repo + Given I have an existing Wiki page with images linked on page + And I browse to wiki page with images + And I click on image link + Then I should see the new wiki page form + + Scenario: File exists in wiki repo + Given I have an existing Wiki page with images linked on page + And I browse to wiki page with images + And I click on existing image link + Then I should see the image from wiki repo diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb index a819ee37d7f..4195ce5b28c 100644 --- a/features/steps/project/wiki.rb +++ b/features/steps/project/wiki.rb @@ -86,6 +86,44 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps page.should have_content @page.title end + Given 'I have an existing Wiki page with images linked on page' do + wiki.create_page("pictures", "Look at this [image](image.jpg)\n\n ![image](image.jpg)", :markdown, "first commit") + @wiki_page = wiki.find_page("pictures") + end + + And 'I browse to wiki page with images' do + visit project_wiki_path(project, @wiki_page) + end + + And 'I click on existing image link' do + Gollum::Wiki.any_instance.should_receive(:file).with("image.jpg", "master", true).and_return(Gollum::File.new(wiki.wiki)) + Gollum::File.any_instance.should_receive(:mime_type).and_return("image/jpeg") + page.should have_link('image', href: "image.jpg") + click_on "image" + end + + Then 'I should see the image from wiki repo' do + url = URI.parse(current_url) + url.path.should match("wikis/image.jpg") + page.should_not have_xpath('/html') # Page should render the image which means there is no html involved + end + + Then 'Image should be shown on the page' do + page.should have_xpath("//img[@src=\"image.jpg\"]") + end + + And 'I click on image link' do + page.should have_link('image', href: "image.jpg") + click_on "image" + end + + Then 'I should see the new wiki page form' do + url = URI.parse(current_url) + url.path.should match("wikis/image.jpg") + page.should have_content('New Wiki Page') + page.should have_content('Editing - image.jpg') + end + def wiki @project_wiki = ProjectWiki.new(project, current_user) end -- GitLab From fac225780cf5579a566977ee78e320ad3f40fd0e Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 5 May 2014 14:01:48 +0200 Subject: [PATCH 100/237] A bit clearer naming for gollum_wiki. --- app/models/wiki_page.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 535bfb5b28a..b8a0a9eb58b 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -175,7 +175,8 @@ class WikiPage end def save(method, *args) - if valid? && wiki.send(method, *args) + project_wiki = wiki + if valid? && project_wiki.send(method, *args) page_details = if method == :update_page @page.path @@ -183,14 +184,15 @@ class WikiPage title end - page_title, page_dir = wiki.page_title_and_dir(page_details) - @page = wiki.wiki.paged(page_title, page_dir) + page_title, page_dir = project_wiki.page_title_and_dir(page_details) + gollum_wiki = project_wiki.wiki + @page = gollum_wiki.paged(page_title, page_dir) set_attributes @persisted = true else - errors.add(:base, wiki.error_message) if wiki.error_message + errors.add(:base, project_wiki.error_message) if project_wiki.error_message @persisted = false end @persisted -- GitLab From f5c4bda8fe53549f2ba63484359543f272954a61 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 5 May 2014 15:07:19 +0300 Subject: [PATCH 101/237] Improve MR seeds Signed-off-by: Dmitriy Zaporozhets --- db/fixtures/development/10_merge_requests.rb | 70 ++++++++------------ 1 file changed, 29 insertions(+), 41 deletions(-) diff --git a/db/fixtures/development/10_merge_requests.rb b/db/fixtures/development/10_merge_requests.rb index cb08a7c2537..62fd0d84ea3 100644 --- a/db/fixtures/development/10_merge_requests.rb +++ b/db/fixtures/development/10_merge_requests.rb @@ -1,45 +1,33 @@ Gitlab::Seeder.quiet do - (1..100).each do |i| - # Random Project - project = Project.all.sample - - # Random user - user = project.team.users.sample - - next unless user - - next if project.empty_repo? - - branches = project.repository.branch_names.sample(2) - - next if branches.uniq.size < 2 - - user_id = user.id - - Gitlab::Seeder.by_user(user) do - MergeRequest.seed(:id, [{ - id: i, - source_branch: branches.first, - target_branch: branches.last, - source_project_id: project.id, - target_project_id: project.id, - author_id: user_id, - assignee_id: user_id, - milestone: project.milestones.sample, - title: Faker::Lorem.sentence(6) - }]) + Project.all.reject(&:empty_repo?).each do |project| + branches = project.repository.branch_names + + branches.each do |branch_name| + break if branches.size < 2 + source_branch = branches.pop + target_branch = branches.pop + + # Random user + user = project.team.users.sample + next unless user + + params = { + source_branch: source_branch, + target_branch: target_branch, + title: Faker::Lorem.sentence(6), + description: Faker::Lorem.sentences(3).join(" ") + } + + merge_request = MergeRequests::CreateService.new(project, user, params).execute + + if merge_request.valid? + merge_request.assignee = user + merge_request.milestone = project.milestones.sample + merge_request.save + print '.' + else + print 'F' + end end - print('.') end end - -MergeRequest.all.map do |mr| - mr.set_iid - mr.save -end - -puts 'Load diffs for Merge Requests (it will take some time)...' -MergeRequest.all.each do |mr| - mr.reload_code - print '.' -end -- GitLab From 23665d2506cfb0d7d30c368f4d82699587b9f86b Mon Sep 17 00:00:00 2001 From: Job van der Voort Date: Mon, 5 May 2014 17:04:19 +0200 Subject: [PATCH 102/237] add loop to deploy key to multiple projects --- doc/api/deploy_key_multiple_projects.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/deploy_key_multiple_projects.md b/doc/api/deploy_key_multiple_projects.md index 56d8d513946..f4121a718e6 100644 --- a/doc/api/deploy_key_multiple_projects.md +++ b/doc/api/deploy_key_multiple_projects.md @@ -18,5 +18,7 @@ curl https://gitlab.com/api/v3/groups/1234?private_token=abcdef # where the id o With those IDs, add the same deploy key to all: ``` -curl -X POST curl https://gitlab.com/api/v3/projects/321/deploy_key_here?private_token=abcdef +for project_id in 321 456 987; do + curl -X POST --data '{"title": "my key", "key": "ssh-rsa AAAA..."}' --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/projects/${project_id}/keys +done ``` -- GitLab From 6dc09db53d5951fe274c3ff6d35ac77d40e2a310 Mon Sep 17 00:00:00 2001 From: Job van der Voort Date: Mon, 5 May 2014 17:14:58 +0200 Subject: [PATCH 103/237] monthly doc tweet template, small changes --- doc/release/monthly.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/release/monthly.md b/doc/release/monthly.md index 44802c347f0..514d73517b2 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -1,5 +1,5 @@ # Monthly Release -NOTE: This is a guide for GitLab developers. If you are trying to install GitLab see the latest stable [installation guide](install/installation.md) and if you are trying to upgrade, see the [upgrade guides](update). +NOTE: This is a guide for GitLab developers. # **15th - Code Freeze & Release Manager** @@ -94,7 +94,9 @@ git tag -a vx.x.0.rc1 -m 'Version x.x.0.rc1' ### **7. Tweet** -Tweet about the RC release. Make sure to explain what a RC is. +Tweet about the RC release: + +> GitLab x.x.x.rc1 is out. This is a release candidate intended for testing only. Please let us know if you find regressions. ### **8. Update Cloud** @@ -103,7 +105,7 @@ Merge the RC1 code into Cloud. Once the build is green, deploy in the morning. It is important to do this as soon as possible, so we can catch any errors before we release the full version. -# **22nd - Release** +# **22nd - Release CE and EE** For GitLab EE, append -ee to the branches and tags. -- GitLab From 06bed543e69c16d4c267d1bd49e879c3e9b761e9 Mon Sep 17 00:00:00 2001 From: Philip Blatter Date: Wed, 22 Jan 2014 01:34:39 +0100 Subject: [PATCH 104/237] Added email threading for update emails on issues and merge requests (if the mail client support the References: mail header) --- app/mailers/emails/issues.rb | 4 ++++ app/mailers/emails/merge_requests.rb | 4 ++++ app/mailers/emails/notes.rb | 2 ++ app/mailers/notify.rb | 16 ++++++++++++++++ 4 files changed, 26 insertions(+) diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb index d684e354452..a096df9dc0d 100644 --- a/app/mailers/emails/issues.rb +++ b/app/mailers/emails/issues.rb @@ -4,6 +4,7 @@ module Emails @issue = Issue.find(issue_id) @project = @issue.project @target_url = project_issue_url(@project, @issue) + set_message_id("issue_#{issue_id}") mail(from: sender(@issue.author_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) @@ -14,6 +15,7 @@ module Emails @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id @project = @issue.project @target_url = project_issue_url(@project, @issue) + set_reference("issue_#{issue_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) @@ -24,6 +26,7 @@ module Emails @project = @issue.project @updated_by = User.find updated_by_user_id @target_url = project_issue_url(@project, @issue) + set_reference("issue_#{issue_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) @@ -35,6 +38,7 @@ module Emails @project = @issue.project @updated_by = User.find updated_by_user_id @target_url = project_issue_url(@project, @issue) + set_reference("issue_#{issue_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb index a97d55f1b50..994ce692a0f 100644 --- a/app/mailers/emails/merge_requests.rb +++ b/app/mailers/emails/merge_requests.rb @@ -4,6 +4,7 @@ module Emails @merge_request = MergeRequest.find(merge_request_id) @project = @merge_request.project @target_url = project_merge_request_url(@project, @merge_request) + set_message_id("merge_request_#{merge_request_id}") mail(from: sender(@merge_request.author_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) @@ -14,6 +15,7 @@ module Emails @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id @project = @merge_request.project @target_url = project_merge_request_url(@project, @merge_request) + set_reference("merge_request_#{merge_request_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) @@ -24,6 +26,7 @@ module Emails @updated_by = User.find updated_by_user_id @project = @merge_request.project @target_url = project_merge_request_url(@project, @merge_request) + set_reference("merge_request_#{merge_request_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) @@ -33,6 +36,7 @@ module Emails @merge_request = MergeRequest.find(merge_request_id) @project = @merge_request.project @target_url = project_merge_request_url(@project, @merge_request) + set_reference("merge_request_#{merge_request_id}") mail(from: sender(updated_by_user_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index ccbdadf010f..43858ea0245 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -15,6 +15,7 @@ module Emails @issue = @note.noteable @project = @note.project @target_url = project_issue_url(@project, @issue, anchor: "note_#{@note.id}") + set_reference("issue_#{@issue.iid}") mail(from: sender(@note.author_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) @@ -25,6 +26,7 @@ module Emails @merge_request = @note.noteable @project = @note.project @target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{@note.id}") + set_reference("merge_request_#{@merge_request.iid}") mail(from: sender(@note.author_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb index 554f53cf148..84a0da0129d 100644 --- a/app/mailers/notify.rb +++ b/app/mailers/notify.rb @@ -53,6 +53,22 @@ class Notify < ActionMailer::Base end end + # Set the Message-ID header field + # + # local_part - The local part of the message ID + # + def set_message_id(local_part) + headers["Message-ID"] = "<#{local_part}@#{Gitlab.config.gitlab.host}>" + end + + # Set the References header field + # + # local_part - The local part of the referenced message ID + # + def set_reference(local_part) + headers["References"] = "<#{local_part}@#{Gitlab.config.gitlab.host}>" + end + # Formats arguments into a String suitable for use as an email subject # # extra - Extra Strings to be inserted into the subject -- GitLab From 11bedfe37d4a19d6aa22a45fbce6622bbbb09cb6 Mon Sep 17 00:00:00 2001 From: Philip Blatter Date: Tue, 4 Mar 2014 15:14:38 +0100 Subject: [PATCH 105/237] Now using correct ids as reference if we are informing about a new note. --- app/mailers/emails/notes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 43858ea0245..d2db881cfc2 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -15,7 +15,7 @@ module Emails @issue = @note.noteable @project = @note.project @target_url = project_issue_url(@project, @issue, anchor: "note_#{@note.id}") - set_reference("issue_#{@issue.iid}") + set_reference("issue_#{@issue.id}") mail(from: sender(@note.author_id), to: recipient(recipient_id), subject: subject("#{@issue.title} (##{@issue.iid})")) @@ -26,7 +26,7 @@ module Emails @merge_request = @note.noteable @project = @note.project @target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{@note.id}") - set_reference("merge_request_#{@merge_request.iid}") + set_reference("merge_request_#{@merge_request.id}") mail(from: sender(@note.author_id), to: recipient(recipient_id), subject: subject("#{@merge_request.title} (!#{@merge_request.iid})")) -- GitLab From a7bdf87f434a09afd7e96c2e7f99cc3fc5be9a07 Mon Sep 17 00:00:00 2001 From: Philip Blatter Date: Tue, 4 Mar 2014 15:14:58 +0100 Subject: [PATCH 106/237] Added some tests. --- spec/mailers/notify_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index e86a60a42b5..7a2fe750f40 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -161,6 +161,10 @@ describe Notify do it 'contains a link to the new issue' do should have_body_text /#{project_issue_path project, issue}/ end + + it 'has the correct message-id set' do + should have_header 'Message-ID', "" + end end describe 'that are new with a description' do @@ -197,6 +201,10 @@ describe Notify do it 'contains a link to the issue' do should have_body_text /#{project_issue_path project, issue}/ end + + it 'has the correct reference set' do + should have_header 'References', "" + end end describe 'status changed' do @@ -224,6 +232,10 @@ describe Notify do it 'contains a link to the issue' do should have_body_text /#{project_issue_path project, issue}/ end + + it 'has the correct reference set' do + should have_header 'References', "" + end end end @@ -253,6 +265,10 @@ describe Notify do it 'contains the target branch for the merge request' do should have_body_text /#{merge_request.target_branch}/ end + + it 'has the correct message-id set' do + should have_header 'Message-ID', "" + end end describe 'that are new with a description' do @@ -313,6 +329,10 @@ describe Notify do it 'contains a link to the merge request' do should have_body_text /#{project_merge_request_path project, merge_request}/ end + + it 'has the correct reference set' do + should have_header 'References', "" + end end end end -- GitLab From de576be52e6a05b6db95d2559a53b71c249be5c4 Mon Sep 17 00:00:00 2001 From: maiki Date: Mon, 5 May 2014 15:47:56 -0700 Subject: [PATCH 107/237] Fixed misspelling Change one letter, change the world! --- doc/public_access/public_access.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/public_access/public_access.md b/doc/public_access/public_access.md index bf9d2784aff..76d83e6f3b6 100644 --- a/doc/public_access/public_access.md +++ b/doc/public_access/public_access.md @@ -4,7 +4,7 @@ Internal projects will only be available to authenticated users. #### Public projects Public projects can be cloned **without any** authentication. -It will also be listen on the [public access directory](/public). +It will also be listed on the [public access directory](/public). **Any logged in user** will have [Guest](/help/permissions) permissions on the repository. #### Internal projects -- GitLab From fd7a221cca9d5ac5338b265fb66b280e205b6330 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 6 May 2014 09:07:15 +0300 Subject: [PATCH 108/237] Change gitlab:test task Signed-off-by: Dmitriy Zaporozhets --- lib/tasks/gitlab/test.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake index 2c9b9978933..9516210e205 100644 --- a/lib/tasks/gitlab/test.rake +++ b/lib/tasks/gitlab/test.rake @@ -8,9 +8,9 @@ namespace :gitlab do ] cmds.each do |cmd| - system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) + result = system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) - raise "#{cmd} failed!" unless $?.exitstatus.zero? + raise "#{cmd} failed!" unless result end end end -- GitLab From b96ad52e10151fed49f63b107ce6871c8d25647e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 6 May 2014 09:07:15 +0300 Subject: [PATCH 109/237] Change gitlab:test task Signed-off-by: Dmitriy Zaporozhets --- lib/tasks/gitlab/test.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/gitlab/test.rake b/lib/tasks/gitlab/test.rake index 2c9b9978933..9516210e205 100644 --- a/lib/tasks/gitlab/test.rake +++ b/lib/tasks/gitlab/test.rake @@ -8,9 +8,9 @@ namespace :gitlab do ] cmds.each do |cmd| - system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) + result = system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd) - raise "#{cmd} failed!" unless $?.exitstatus.zero? + raise "#{cmd} failed!" unless result end end end -- GitLab From 00cd3ecc44a6c6d29565c95cd5173c8e5de35537 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 6 May 2014 09:57:08 +0200 Subject: [PATCH 110/237] Use stub in testing. --- features/steps/project/wiki.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb index 4195ce5b28c..3244a5a05af 100644 --- a/features/steps/project/wiki.rb +++ b/features/steps/project/wiki.rb @@ -96,8 +96,9 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps end And 'I click on existing image link' do - Gollum::Wiki.any_instance.should_receive(:file).with("image.jpg", "master", true).and_return(Gollum::File.new(wiki.wiki)) - Gollum::File.any_instance.should_receive(:mime_type).and_return("image/jpeg") + file = Gollum::File.new(wiki.wiki) + Gollum::Wiki.any_instance.stub(:file).with("image.jpg", "master", true).and_return(file) + Gollum::File.any_instance.stub(:mime_type).and_return("image/jpeg") page.should have_link('image', href: "image.jpg") click_on "image" end -- GitLab From b1d68b6e9bd837b3b685b76ceca1b6a44cf2dc17 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Tue, 1 Apr 2014 15:39:26 +0100 Subject: [PATCH 111/237] Add .pkgr.yml file for automated packaging on https://pkgr.io --- .pkgr.yml | 19 +++++++++++++++++++ bin/pkgr_before_precompile.sh | 16 ++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .pkgr.yml create mode 100755 bin/pkgr_before_precompile.sh diff --git a/.pkgr.yml b/.pkgr.yml new file mode 100644 index 00000000000..09cb83783dc --- /dev/null +++ b/.pkgr.yml @@ -0,0 +1,19 @@ +user: git +group: git +before_precompile: ./bin/pkgr_before_precompile.sh +targets: + debian-7: &wheezy + build_dependencies: + - libicu-dev + dependencies: + - libicu48 + - libpcre3 + - git + ubuntu-12.04: *wheezy + ubuntu-14.04: + build_dependencies: + - libicu-dev + dependencies: + - libicu52 + - libpcre3 + - git diff --git a/bin/pkgr_before_precompile.sh b/bin/pkgr_before_precompile.sh new file mode 100755 index 00000000000..126f9fda72e --- /dev/null +++ b/bin/pkgr_before_precompile.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -ex + +for file in config/*.yml.example; do + cp ${file} config/$(basename ${file} .example) +done + +# No need for config file. Will be taken care of by REDIS_URL env variable +rm config/resque.yml + +# Set default unicorn.rb file +echo "" > config/unicorn.rb + +# Required for assets precompilation +sudo service postgresql start -- GitLab From 402361afff4a4eb8c19ea7ab4f4c6ec5daf64221 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Tue, 15 Apr 2014 17:58:12 +0100 Subject: [PATCH 112/237] Setup default gitlab.yml with possibility to override default url via environment variable. This only applies to packaging with https://pkgr.io. --- bin/pkgr_before_precompile.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/pkgr_before_precompile.sh b/bin/pkgr_before_precompile.sh index 126f9fda72e..283abb6a0cd 100755 --- a/bin/pkgr_before_precompile.sh +++ b/bin/pkgr_before_precompile.sh @@ -1,11 +1,18 @@ #!/bin/sh -set -ex +set -e for file in config/*.yml.example; do cp ${file} config/$(basename ${file} .example) done +# Allow to override the Gitlab URL from an environment variable, as this will avoid having to change the configuration file for simple deployments. +config=$(echo '<% gitlab_url = URI(ENV["GITLAB_URL"] || "http://localhost:80") %>' | cat - config/gitlab.yml) +echo "$config" > config/gitlab.yml +sed -i "s/host: localhost/host: <%= gitlab_url.host %>/" config/gitlab.yml +sed -i "s/port: 80/port: <%= gitlab_url.port %>/" config/gitlab.yml +sed -i "s/https: false/https: <%= gitlab_url.scheme == 'https' %>/" config/gitlab.yml + # No need for config file. Will be taken care of by REDIS_URL env variable rm config/resque.yml -- GitLab From 536b2f2f75d384446e4d3d103903a6ff909bd4da Mon Sep 17 00:00:00 2001 From: Ahmed Shafeeq Date: Tue, 6 May 2014 22:02:21 +0800 Subject: [PATCH 113/237] Use production for Gitlab shell installation --- doc/install/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index 90d6f0e17ed..a441d2b65a5 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -260,7 +260,7 @@ GitLab Shell is an ssh access and repository management software developed speci cd /home/git/gitlab # Run the installation task for gitlab-shell (replace `REDIS_URL` if needed): - sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.3] REDIS_URL=redis://localhost:6379 + sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.3] REDIS_URL=redis://localhost:6379 RAILS_ENV=production # By default, the gitlab-shell config is generated from your main gitlab config. You can review (and modify) it as follows: sudo -u git -H editor /home/git/gitlab-shell/config.yml -- GitLab From 14102fd2112dba60795421726bbf6d59dac273da Mon Sep 17 00:00:00 2001 From: Ahmed Shafeeq Date: Wed, 7 May 2014 01:14:00 +0800 Subject: [PATCH 114/237] Remove extra "Compile assets" section --- doc/install/installation.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index a441d2b65a5..28758197f33 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -302,11 +302,6 @@ Check if GitLab and its environment are configured correctly: sudo /etc/init.d/gitlab restart -## Compile assets - - sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production - - # 6. Nginx **Note:** -- GitLab From fa7d0e3ae0bcc1f2aa4a46b0ca3b80e78d3c3c46 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 May 2014 12:21:02 +0300 Subject: [PATCH 115/237] Fix MR widget UI Signed-off-by: Dmitriy Zaporozhets --- .../merge_requests/show/_state_widget.html.haml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/views/projects/merge_requests/show/_state_widget.html.haml b/app/views/projects/merge_requests/show/_state_widget.html.haml index c9ecbceaf54..80fe540489b 100644 --- a/app/views/projects/merge_requests/show/_state_widget.html.haml +++ b/app/views/projects/merge_requests/show/_state_widget.html.haml @@ -21,14 +21,6 @@ #{time_ago_with_tooltip(@merge_request.merge_event.created_at)} = render "projects/merge_requests/show/remove_source_branch" - - if !@closes_issues.empty? && @merge_request.open? - .alert.alert-info.alert-info - %span - %i.icon-ok - Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'} - = succeed '.' do - != gfm(@closes_issues.map { |i| "##{i.iid}" }.to_sentence) - - unless @commits.any? %h4 Nothing to merge %p @@ -38,3 +30,12 @@ %span.label-branch #{@merge_request.target_branch} %br Try to use different branches or push new code. + + - if !@closes_issues.empty? && @merge_request.open? + .panel-footer + %span + %i.icon-ok + Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'} + = succeed '.' do + != gfm(@closes_issues.map { |i| "##{i.iid}" }.to_sentence) + -- GitLab From 99e0d0dd6f9d1a6b66c5322f142e6dd008f62ebd Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 7 May 2014 11:52:07 +0200 Subject: [PATCH 116/237] Unstub after the test is done. --- features/project/wiki.feature | 12 ++++++------ features/steps/project/wiki.rb | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/features/project/wiki.feature b/features/project/wiki.feature index 41c51f2c42e..4a8c771ddac 100644 --- a/features/project/wiki.feature +++ b/features/project/wiki.feature @@ -46,6 +46,12 @@ Feature: Project Wiki And I click on the "Pages" button Then I should see the existing page in the pages list + Scenario: File exists in wiki repo + Given I have an existing Wiki page with images linked on page + And I browse to wiki page with images + And I click on existing image link + Then I should see the image from wiki repo + Scenario: Image in wiki repo shown on the page Given I have an existing Wiki page with images linked on page And I browse to wiki page with images @@ -56,9 +62,3 @@ Feature: Project Wiki And I browse to wiki page with images And I click on image link Then I should see the new wiki page form - - Scenario: File exists in wiki repo - Given I have an existing Wiki page with images linked on page - And I browse to wiki page with images - And I click on existing image link - Then I should see the image from wiki repo diff --git a/features/steps/project/wiki.rb b/features/steps/project/wiki.rb index 3244a5a05af..96f2505d24c 100644 --- a/features/steps/project/wiki.rb +++ b/features/steps/project/wiki.rb @@ -107,6 +107,8 @@ class Spinach::Features::ProjectWiki < Spinach::FeatureSteps url = URI.parse(current_url) url.path.should match("wikis/image.jpg") page.should_not have_xpath('/html') # Page should render the image which means there is no html involved + Gollum::Wiki.any_instance.unstub(:file) + Gollum::File.any_instance.unstub(:mime_type) end Then 'Image should be shown on the page' do -- GitLab From c9104fa6e435a713dcdeb6de9db15079b4851aa7 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 May 2014 14:26:49 +0300 Subject: [PATCH 117/237] Fix search dropdown css. Improve jquery styles Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/jquery.scss | 39 ++++++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/generic/jquery.scss b/app/assets/stylesheets/generic/jquery.scss index 4a9341e8f53..6b29accb315 100644 --- a/app/assets/stylesheets/generic/jquery.scss +++ b/app/assets/stylesheets/generic/jquery.scss @@ -8,7 +8,7 @@ width: 270px; .ui-datepicker-header { - background: #EEE; + background: #FFF; border-color: #DDD; } @@ -19,20 +19,37 @@ } &.ui-autocomplete { - @include border-radius(0px); border-color: #DDD; padding: 0; + margin-top: 2px; + z-index: 1001; .ui-menu-item a { - color: #777; - - &:hover { - background: $hover; - border-color: $primary_color; - @include border-radius(0px); - color: #333; - } + padding: 4px 10px; } } -} + .ui-state-default { + border: 1px solid #FFF; + background: #FFF; + color: #777; + } + + .ui-state-highlight { + border: 1px solid #EEE; + background: #EEE; + } + + .ui-state-active { + border: 1px solid $bg_style_color; + background: $bg_style_color; + color: #FFF; + } + + .ui-state-hover, + .ui-state-focus { + border: 1px solid $hover; + background: $hover; + color: #333; + } +} -- GitLab From 18529269c6adf102d2e521bd5241794ea2347b55 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 May 2014 14:43:07 +0300 Subject: [PATCH 118/237] truncate long branch names on MR index Signed-off-by: Dmitriy Zaporozhets --- .../projects/merge_requests/_merge_request.html.haml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index 980ac126742..d1cab89a35c 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -11,13 +11,9 @@ - if merge_request.for_fork? %span.light #{merge_request.source_project_namespace}: - = merge_request.source_branch - %i.icon-angle-right.light - = merge_request.target_branch - - else - = merge_request.source_branch - %i.icon-angle-right.light - = merge_request.target_branch + = truncate merge_request.source_branch, length: 25 + %i.icon-angle-right.light + = merge_request.target_branch .merge-request-info - if merge_request.author authored by #{link_to_member(merge_request.source_project, merge_request.author)} -- GitLab From 97eb2240b1e401bf75408b9cc6b1560bc52ab849 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 May 2014 14:52:43 +0300 Subject: [PATCH 119/237] Fix check-all issues checkbox position Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/sections/issues.scss | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/assets/stylesheets/sections/issues.scss b/app/assets/stylesheets/sections/issues.scss index 3c48361b2ec..02c9123178f 100644 --- a/app/assets/stylesheets/sections/issues.scss +++ b/app/assets/stylesheets/sections/issues.scss @@ -45,14 +45,6 @@ padding: 6px 10px; border: 1px solid #ccc; @include border-radius(4px); - - - input.check_all_issues { - padding: 0; - margin: 0; - position: relative; - top: 3px; - } } .issues_content { -- GitLab From 4fea8afc4bc507bf94d93c1ef04a9575add900ab Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 May 2014 16:14:24 +0300 Subject: [PATCH 120/237] Add CompareAction class for collecting commits and diffs using satellites Signed-off-by: Dmitriy Zaporozhets --- app/models/merge_request_diff.rb | 16 +++++++- lib/gitlab/satellite/compare_action.rb | 53 ++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 lib/gitlab/satellite/compare_action.rb diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index 0684461add7..7dce71a677b 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -86,7 +86,7 @@ class MergeRequestDiff < ActiveRecord::Base # between target and source branches def unmerged_commits commits = if merge_request.for_fork? - Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between + compare_action.commits else repository.commits_between(target_branch, source_branch) end @@ -150,7 +150,7 @@ class MergeRequestDiff < ActiveRecord::Base # between target and source branches def unmerged_diffs diffs = if merge_request.for_fork? - Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diffs_between_satellite + compare_action.diffs else Gitlab::Git::Diff.between(repository, source_branch, target_branch) end @@ -165,4 +165,16 @@ class MergeRequestDiff < ActiveRecord::Base def repository merge_request.target_project.repository end + + private + + def compare_action + Gitlab::Satellite::CompareAction.new( + merge_request.author, + merge_request.target_project, + merge_request.target_branch, + merge_request.source_project, + merge_request.source_branch + ) + end end diff --git a/lib/gitlab/satellite/compare_action.rb b/lib/gitlab/satellite/compare_action.rb new file mode 100644 index 00000000000..c923bb9c0f0 --- /dev/null +++ b/lib/gitlab/satellite/compare_action.rb @@ -0,0 +1,53 @@ +module Gitlab + module Satellite + class CompareAction < Action + def initialize(user, target_project, target_branch, source_project, source_branch) + super user, target_project + + @target_project, @target_branch = target_project, target_branch + @source_project, @source_branch = source_project, source_branch + end + + # Only show what is new in the source branch compared to the target branch, not the other way around. + # The line below with merge_base is equivalent to diff with three dots (git diff branch1...branch2) + # From the git documentation: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B" + def diffs + in_locked_and_timed_satellite do |target_repo| + prepare_satellite!(target_repo) + update_satellite_source_and_target!(target_repo) + common_commit = target_repo.git.native(:merge_base, default_options, ["origin/#{@target_branch}", "source/#{@source_branch}"]).strip + #this method doesn't take default options + diffs = target_repo.diff(common_commit, "source/#{@source_branch}") + diffs = diffs.map { |diff| Gitlab::Git::Diff.new(diff) } + diffs + end + rescue Grit::Git::CommandFailed => ex + handle_exception(ex) + end + + # Retrieve an array of commits between the source and the target + def commits + in_locked_and_timed_satellite do |target_repo| + prepare_satellite!(target_repo) + update_satellite_source_and_target!(target_repo) + commits = target_repo.commits_between("origin/#{@target_branch}", "source/#{@source_branch}") + commits = commits.map { |commit| Gitlab::Git::Commit.new(commit, nil) } + commits + end + rescue Grit::Git::CommandFailed => ex + handle_exception(ex) + end + + private + + # Assumes a satellite exists that is a fresh clone of the projects repo, prepares satellite for diffs + def update_satellite_source_and_target!(target_repo) + target_repo.remote_add('source', @source_project.repository.path_to_repo) + target_repo.remote_fetch('source') + target_repo.git.checkout(default_options({b: true}), @target_branch, "origin/#{@target_branch}") + rescue Grit::Git::CommandFailed => ex + handle_exception(ex) + end + end + end +end -- GitLab From a8624cbe5927ceed786b5aa68fe9e917b1d8cbee Mon Sep 17 00:00:00 2001 From: skv-headless Date: Wed, 7 May 2014 17:50:56 +0400 Subject: [PATCH 121/237] submit notes forms by pressing ctrl+enter --- app/assets/javascripts/notes.js.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index 8b152005639..47989010d1a 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -53,6 +53,12 @@ class Notes # fetch notes when tab becomes visible $(document).on "visibilitychange", @visibilityChange + @notes_forms = '.js-main-target-form textarea, .js-discussion-note-form textarea' + $(document).on('keypress', @notes_forms, (e)-> + if event.keyCode == 10 || (event.ctrlKey && event.keyCode == 13) + $(@).parents('form').submit() + ) + cleanBinding: -> $(document).off "ajax:success", ".js-main-target-form" $(document).off "ajax:success", ".js-discussion-note-form" @@ -67,6 +73,7 @@ class Notes $(document).off "click", ".js-discussion-reply-button" $(document).off "click", ".js-add-diff-note-button" $(document).off "visibilitychange" + $(document).off "keypress", @notes_forms initRefresh: -> -- GitLab From 9e805b77544df5be602d0c218d7be1047eb6729f Mon Sep 17 00:00:00 2001 From: "C. Morgan Hamill" Date: Wed, 7 May 2014 16:33:54 -0400 Subject: [PATCH 122/237] Provide fallback for missing `name` value. If `auth.info.name` is `nil`, then use `auth.info.first_name + auth.info.last_name` as the value of `name`. --- lib/gitlab/oauth/user.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb index 1bac93378ef..c6f56c141e5 100644 --- a/lib/gitlab/oauth/user.rb +++ b/lib/gitlab/oauth/user.rb @@ -65,7 +65,11 @@ module Gitlab end def name - auth.info.name.to_s.force_encoding("utf-8") + unless auth.info.name.nil? + auth.info.name.to_s.force_encoding("utf-8") + else + "#{auth.info.first_name} #{auth.info.last_name}".force_encoding("utf-8") + end end def username -- GitLab From a45f7262f9a3e26361b6fde4f77d0d27437535cf Mon Sep 17 00:00:00 2001 From: "C. Morgan Hamill" Date: Wed, 7 May 2014 16:41:35 -0400 Subject: [PATCH 123/237] Clean up of `name` fallback code. Don't use `unless` for the conditional. Avoid double-quotes where possible. --- lib/gitlab/oauth/user.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb index c6f56c141e5..e9e57aa5742 100644 --- a/lib/gitlab/oauth/user.rb +++ b/lib/gitlab/oauth/user.rb @@ -65,10 +65,10 @@ module Gitlab end def name - unless auth.info.name.nil? - auth.info.name.to_s.force_encoding("utf-8") + if !auth.info.name.nil? + auth.info.name.to_s.force_encoding('utf-8') else - "#{auth.info.first_name} #{auth.info.last_name}".force_encoding("utf-8") + "#{auth.info.first_name} #{auth.info.last_name}".force_encoding('utf-8') end end -- GitLab From 5f74f0511fbf75b719528d55f7d1f5d7c52f21b8 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 8 May 2014 09:13:41 +0200 Subject: [PATCH 124/237] Update gitlab-grit to 2.6.6. --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 35645663269..f4513af7a84 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -162,7 +162,7 @@ GEM multi_json gitlab-grack (2.0.0.pre) rack (~> 1.5.1) - gitlab-grit (2.6.5) + gitlab-grit (2.6.6) charlock_holmes (~> 0.6) diff-lcs (~> 1.1) mime-types (~> 1.15) -- GitLab From c01efa0ed5a9dadd2daf8cc63c5612864c771f23 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 12:10:04 +0200 Subject: [PATCH 125/237] Document how to convert a backup to PostgreSQL --- CHANGELOG | 1 + doc/update/mysql_to_postgresql.md | 47 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d3561d2efc9..cc271f5e2cd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,7 @@ v 6.9.0 - Improve comments loading logic - Stop refreshing comments when the tab is hidden - Improve issue and merge request mobile UI (Drew Blessing) + - Document how to convert a backup to PostgreSQL v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index 9a324545eb0..cdef7d71e33 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -1,5 +1,9 @@ # Use the shell commands below to convert a MySQL GitLab database to a PostgreSQL one. +## Export from MySQL and import into Postgres + +Use this if you are keeping GitLab on the same server. + ``` git clone https://github.com/lanyrd/mysql-postgresql-converter.git cd mysql-postgresql-converter @@ -7,3 +11,46 @@ mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.m python db_converter.py databasename.mysql databasename.psql psql -f databasename.psql -d gitlabhq_production ``` + +## Converting a GitLab backup file from MySQL to Postgres + +GitLab backup files (_gitlab_backup.tar) contain a SQL dump. Using +the lanyrd database converter we can replace a MySQL database dump inside the +tar file with a Postgres database dump. This can be useful if you are moving to +another server. + +``` +# Stop GitLab +sudo service gitlab stop + +# Create the backup +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production + +# Note the filename of the backup that was created. We will call it +# TIMESTAMP_gitlab_backup.tar below. + +# Move the backup file we will convert to its own directory +sudo -u git -H mkdir -p tmp/backups/postgresql +sudo -u git -H mv tmp/backups/TIMESTAMP_gitlab_backup.tar tmp/backups/postgresql/ + +# Create a separate database dump with PostgreSQL compatibility +cd tmp/backups/postgresql +sudo -u git -H mysqldump --compatible=postgresql --default-character-set=utf8 -r gitlabhq_production.mysql -u root gitlabhq_production + +# Clone the database converter +sudo -u git -H git clone https://github.com/lanyrd/mysql-postgresql-converter.git + +# Convert gitlabhq_production.mysql +sudo -u git -H mkdir db +sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_production.mysql db/database.sql + +# Replace the MySQL dump in TIMESTAMP_gitlab_backup.tar. + +# Warning: if you forget to replace TIMESTAMP below, tar will create a new file +# 'TIMESTAMP_gitlab_backup.tar' without giving an error. + +sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql + +# Done! TIMESTAMP_gitlab_backup.tar can now be restored into a Postgres GitLab installation. +``` -- GitLab From da9b009d31ee342d96da7b8796b937849de650cd Mon Sep 17 00:00:00 2001 From: Sean Edge Date: Tue, 6 May 2014 17:28:21 -0400 Subject: [PATCH 126/237] Add fix for API when branch names have periods in them. Relates to issue #6128 (https://github.com/gitlabhq/gitlabhq/issues/6128). --- lib/api/branches.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/api/branches.rb b/lib/api/branches.rb index 953c6100f8b..d54f9371fbe 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -24,7 +24,7 @@ module API # branch (required) - The name of the branch # Example Request: # GET /projects/:id/repository/branches/:branch - get ":id/repository/branches/:branch" do + get ':id/repository/branches/:branch', requirements: { branch: /.*/ } do @branch = user_project.repo.heads.find { |item| item.name == params[:branch] } not_found!("Branch does not exist") if @branch.nil? present @branch, with: Entities::RepoObject, project: user_project @@ -37,7 +37,9 @@ module API # branch (required) - The name of the branch # Example Request: # PUT /projects/:id/repository/branches/:branch/protect - put ":id/repository/branches/:branch/protect" do + put ':id/repository/branches/:branch/protect', + requirements: { branch: /.*/ } do + authorize_admin_project @branch = user_project.repository.find_branch(params[:branch]) @@ -55,7 +57,9 @@ module API # branch (required) - The name of the branch # Example Request: # PUT /projects/:id/repository/branches/:branch/unprotect - put ":id/repository/branches/:branch/unprotect" do + put ':id/repository/branches/:branch/unprotect', + requirements: { branch: /.*/ } do + authorize_admin_project @branch = user_project.repository.find_branch(params[:branch]) -- GitLab From 92591b63dcba5115537cd1e6da714540590975b8 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 13:18:12 +0200 Subject: [PATCH 127/237] Add an introcudtion to mysql_to_postgresql.md --- doc/update/mysql_to_postgresql.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index cdef7d71e33..661dcc02ba8 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -1,4 +1,10 @@ -# Use the shell commands below to convert a MySQL GitLab database to a PostgreSQL one. +# Migrating GitLab from MySQL to Postgres + +If you are replacing MySQL with Postgres while keeping GitLab on the same +server all you need to do is to export from MySQL and import into Postgres as +described below. If you are also moving GitLab to another server, or if you are +switching to omnibus-gitlab, you may want to use a GitLab backup file. The +second part of this documents explains the procedure to do this. ## Export from MySQL and import into Postgres -- GitLab From 3bfbea37e9a0cca64bf67e0a8a8ce3ceb9b9db55 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 13:18:22 +0200 Subject: [PATCH 128/237] Indicate when to stop/start GitLab --- doc/update/mysql_to_postgresql.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index 661dcc02ba8..5b9209d7df4 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -11,11 +11,17 @@ second part of this documents explains the procedure to do this. Use this if you are keeping GitLab on the same server. ``` +sudo service gitlab stop + +# Update /home/git/gitlab/config/database.yml + git clone https://github.com/lanyrd/mysql-postgresql-converter.git cd mysql-postgresql-converter mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production python db_converter.py databasename.mysql databasename.psql psql -f databasename.psql -d gitlabhq_production + +sudo service gitlab start ``` ## Converting a GitLab backup file from MySQL to Postgres -- GitLab From 5014a5b7d51f329311b80f8c0770b11616812120 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 13:59:31 +0200 Subject: [PATCH 129/237] Update rails to 4.0.5 --- Gemfile.lock | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 35645663269..20fcc3964a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,26 +2,26 @@ GEM remote: https://rubygems.org/ specs: ace-rails-ap (2.0.1) - actionmailer (4.0.3) - actionpack (= 4.0.3) + actionmailer (4.0.5) + actionpack (= 4.0.5) mail (~> 2.5.4) - actionpack (4.0.3) - activesupport (= 4.0.3) + actionpack (4.0.5) + activesupport (= 4.0.5) builder (~> 3.1.0) erubis (~> 2.7.0) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.3) - activesupport (= 4.0.3) + activemodel (4.0.5) + activesupport (= 4.0.5) builder (~> 3.1.0) - activerecord (4.0.3) - activemodel (= 4.0.3) + activerecord (4.0.5) + activemodel (= 4.0.5) activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.3) + activesupport (= 4.0.5) arel (~> 4.0.0) activerecord-deprecated_finders (1.0.3) - activesupport (4.0.3) - i18n (~> 0.6, >= 0.6.4) + activesupport (4.0.5) + i18n (~> 0.6, >= 0.6.9) minitest (~> 4.2) multi_json (~> 1.3) thread_safe (~> 0.1) @@ -279,7 +279,7 @@ GEM mime-types (1.25.1) mini_portile (0.5.3) minitest (4.7.5) - multi_json (1.9.3) + multi_json (1.10.0) multi_xml (0.5.5) multipart-post (1.2.0) mysql2 (0.3.11) @@ -349,13 +349,13 @@ GEM rack rack-test (0.6.2) rack (>= 1.0) - rails (4.0.3) - actionmailer (= 4.0.3) - actionpack (= 4.0.3) - activerecord (= 4.0.3) - activesupport (= 4.0.3) + rails (4.0.5) + actionmailer (= 4.0.5) + actionpack (= 4.0.5) + activerecord (= 4.0.5) + activesupport (= 4.0.5) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.3) + railties (= 4.0.5) sprockets-rails (~> 2.0.0) rails-observers (0.1.2) activemodel (~> 4.0) @@ -368,9 +368,9 @@ GEM i18n require_all ruby-progressbar - railties (4.0.3) - actionpack (= 4.0.3) - activesupport (= 4.0.3) + railties (4.0.5) + actionpack (= 4.0.5) + activesupport (= 4.0.5) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) raindrops (0.12.0) @@ -478,7 +478,7 @@ GEM spring (>= 0.9.1) spring-commands-spinach (1.0.0) spring (>= 0.9.1) - sprockets (2.10.1) + sprockets (2.12.1) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) -- GitLab From 23de3551ab1ece5a3782c07d3a88a092122431d0 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:37:36 +0300 Subject: [PATCH 130/237] Add MergeRequest#target_project_namespace Signed-off-by: Dmitriy Zaporozhets --- app/models/merge_request.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 8c885b70a48..134a8c8dd40 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -253,6 +253,14 @@ class MergeRequest < ActiveRecord::Base end end + def target_project_namespace + if target_project && target_project.namespace + target_project.namespace.path + else + "(removed)" + end + end + def source_branch_exists? return false unless self.source_project -- GitLab From 05e63fe09c8a44ed14d4282db81d18927ce1a5ad Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:38:17 +0300 Subject: [PATCH 131/237] MergeRequest#new 2 step process Signed-off-by: Dmitriy Zaporozhets --- .../merge_requests/_new_compare.html.haml | 69 +++++++++++++++++++ .../merge_requests/_new_submit.html.haml | 60 ++++++++++++++++ .../projects/merge_requests/new.html.haml | 7 +- 3 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 app/views/projects/merge_requests/_new_compare.html.haml create mode 100644 app/views/projects/merge_requests/_new_submit.html.haml diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml new file mode 100644 index 00000000000..47b8e5c886c --- /dev/null +++ b/app/views/projects/merge_requests/_new_compare.html.haml @@ -0,0 +1,69 @@ +%h3.page-title Compare changes for new merge request +%hr + += form_for [@project, @merge_request], url: new_project_merge_request_path(@project), method: :get, html: { class: "merge-request-form form-inline" } do |f| + .merge-request-branches.row + .col-md-6 + .panel.panel-default + .panel-heading + From + .panel-body + = f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project select2 span3', disabled: @merge_request.persisted? }) +   + = f.select(:source_branch, @merge_request.source_branches, { include_blank: "Select branch" }, {class: 'source_branch select2 span2'}) + .panel-footer + .mr_source_commit + + .col-md-6 + .panel.panel-default + .panel-heading + To + .panel-body + - projects = @project.forked_from_project.nil? ? [@project] : [@project, @project.forked_from_project] + = f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace', f.object.target_project_id), {}, { class: 'target_project select2 span3', disabled: @merge_request.persisted? }) +   + = f.select(:target_branch, @merge_request.target_branches, { include_blank: "Select branch" }, {class: 'target_branch select2 span2'}) + .panel-footer + .mr_target_commit + + -if @merge_request.errors.any? + .alert.alert-danger + - @merge_request.errors.full_messages.each do |msg| + %div= msg + + - if @merge_request.source_branch.present? && @merge_request.target_branch.present? + .light-well + %center + %h4 + There isn't anything to merge. + %p.slead + - if @merge_request.source_branch == @merge_request.target_branch + You'll need to use different branch names to get a valid comparison. + - else + %span.label-branch #{@merge_request.source_branch} + and + %span.label-branch #{@merge_request.target_branch} + are the same. + + .form-actions + = f.submit 'Compare branches', class: "btn btn-primary" + +:javascript + var source_branch = $("#merge_request_source_branch") + , target_branch = $("#merge_request_target_branch") + , target_project = $("#merge_request_target_project_id"); + + $.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: source_branch.val() }); + $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: target_branch.val() }); + + target_project.on("change", function() { + $.get("#{update_branches_project_merge_requests_path(@source_project)}", {target_project_id: $(this).val() }); + }); + source_branch.on("change", function() { + $.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: $(this).val() }); + }); + target_branch.on("change", function() { + $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() }); + }); + + diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml new file mode 100644 index 00000000000..ea79b78e76c --- /dev/null +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -0,0 +1,60 @@ +%h3.page-title + New merge request +%p.slead + From + %strong.monospace + #{@merge_request.source_project_namespace}:#{@merge_request.source_branch} + into + %strong.monospace + #{@merge_request.target_project_namespace}:#{@merge_request.target_branch} + + %span.pull-right + = link_to 'Change branches', new_project_merge_request_path(@project) + += form_for [@project, @merge_request], html: { class: "merge-request-form" } do |f| + .panel.panel-default + + .panel-body + .form-group + .light + = f.label :title do + = "Title *" + = f.text_field :title, class: "form-control input-lg js-gfm-input", maxlength: 255, rows: 5, required: true + .form-group + .light + = f.label :description, "Description" + = f.text_area :description, class: "form-control js-gfm-input", rows: 10 + %p.hint Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. + .panel-footer + - if @target_repo.contribution_guide + - contribution_guide_url = project_blob_path(@target_project, tree_join(@target_repo.root_ref, @target_repo.contribution_guide.name)) + %p + Please review the + %strong #{link_to "guidelines for contribution", contribution_guide_url} + to this repository. + = f.hidden_field :source_project_id + = f.hidden_field :target_project_id + = f.hidden_field :target_branch + = f.hidden_field :source_branch + = f.submit 'Submit a merge request', class: "btn btn-create" + +.mr-compare + %div.ui-box + .title + Commits (#{@commits.count}) + - if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE + %ul.well-list + - Commit.decorate(@commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE)).each do |commit| + = render "projects/commits/inline_commit", commit: commit, project: @project + %li.warning-row.unstyled + other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues. + - else + %ul.well-list= render Commit.decorate(@commits), project: @project + + %h4 Changes + - if @diffs.present? + = render "projects/commits/diffs", diffs: @diffs, project: @project + - elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE + .bs-callout.bs-callout-danger + %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits. + %p To preserve performance the line changes are not shown. diff --git a/app/views/projects/merge_requests/new.html.haml b/app/views/projects/merge_requests/new.html.haml index 8ee0e1a8d46..c24e5916721 100644 --- a/app/views/projects/merge_requests/new.html.haml +++ b/app/views/projects/merge_requests/new.html.haml @@ -1,3 +1,4 @@ -%h3.page-title New Merge Request -%hr -= render 'form' +- if @commits.present? + = render 'new_submit' +- else + = render 'new_compare' -- GitLab From 8eae01ea58c505a3c132e3d4f09cf77e7c1fc574 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:38:52 +0300 Subject: [PATCH 132/237] Compare branches in MergeRequestsController#new action Signed-off-by: Dmitriy Zaporozhets --- .../projects/merge_requests_controller.rb | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 745da9c49e4..d8551db7b01 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -62,11 +62,27 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request.source_project = @project unless @merge_request.source_project @merge_request.target_project ||= (@project.forked_from_project || @project) @target_branches = @merge_request.target_project.nil? ? [] : @merge_request.target_project.repository.branch_names - @merge_request.target_branch ||= @merge_request.target_project.default_branch - @source_project = @merge_request.source_project - @merge_request + + if @merge_request.target_branch && @merge_request.source_branch + compare_action = Gitlab::Satellite::CompareAction.new( + current_user, + @merge_request.target_project, + @merge_request.target_branch, + @merge_request.source_project, + @merge_request.source_branch + ) + + @commits = compare_action.commits + @commits.map! { |commit| Commit.new(commit) } + @commit = @commits.first + + @diffs = compare_action.diffs + @merge_request.title = @merge_request.source_branch.titleize.humanize + @target_project = @merge_request.target_project + @target_repo = @target_project.repository + end end def edit @@ -80,7 +96,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController @merge_request = MergeRequests::CreateService.new(project, current_user, params[:merge_request]).execute if @merge_request.valid? - redirect_to [@merge_request.target_project, @merge_request], notice: 'Merge request was successfully created.' + redirect_to project_merge_request_path(@merge_request.target_project, @merge_request), notice: 'Merge request was successfully created.' else @source_project = @merge_request.source_project @target_project = @merge_request.target_project -- GitLab From 51e976d295edfefd5e2cb2dfc7967fb90c87ac40 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:40:02 +0300 Subject: [PATCH 133/237] Add assignee/milestone block to merge request edit page. And remove branches selector from this page Signed-off-by: Dmitriy Zaporozhets --- .../projects/merge_requests/_form.html.haml | 61 ++++++------------- .../merge_requests/branch_from.js.haml | 5 -- .../merge_requests/show/_mr_title.html.haml | 2 +- 3 files changed, 18 insertions(+), 50 deletions(-) diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml index 0fe2d1d9801..58994e012f9 100644 --- a/app/views/projects/merge_requests/_form.html.haml +++ b/app/views/projects/merge_requests/_form.html.haml @@ -14,33 +14,6 @@ - @merge_request.errors.full_messages.each do |msg| %div= msg - .merge-request-branches - .form-group - = label_tag nil, class: 'control-label' do - From - .col-sm-10 - .clearfix - .pull-left - = f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project select2 span3', disabled: @merge_request.persisted? }) - .pull-left -   - = f.select(:source_branch, @merge_request.source_branches, { include_blank: "Select branch" }, {class: 'source_branch select2 span2'}) - .mr_source_commit - %br - .form-group - = label_tag nil, class: 'control-label' do - To - .col-sm-10 - .clearfix - .pull-left - - projects = @project.forked_from_project.nil? ? [@project] : [@project, @project.forked_from_project] - = f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace', f.object.target_project_id), {}, { class: 'target_project select2 span3', disabled: @merge_request.persisted? }) - .pull-left -   - = f.select(:target_branch, @merge_request.target_branches, { include_blank: "Select branch" }, {class: 'target_branch select2 span2'}) - .mr_target_commit - - %hr .merge-request-form-info .form-group = f.label :title, class: 'control-label' do @@ -51,6 +24,23 @@ .col-sm-10 = f.text_area :description, class: "form-control js-gfm-input", rows: 14 %p.hint Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. + %hr + .form-group + .issue-assignee + = f.label :assignee_id, class: 'control-label' do + %i.icon-user + Assign to + .col-sm-10 + = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id) +   + = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' + .form-group + .issue-milestone + = f.label :milestone_id, class: 'control-label' do + %i.icon-time + Milestone + .col-sm-10= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'}) + .form-actions - if @merge_request.new_record? @@ -66,20 +56,3 @@ :javascript disableButtonIfEmptyField("#merge_request_title", ".btn-save"); - - var source_branch = $("#merge_request_source_branch") - , target_branch = $("#merge_request_target_branch") - , target_project = $("#merge_request_target_project_id"); - - $.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: source_branch.val() }); - $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: target_branch.val() }); - - target_project.on("change", function() { - $.get("#{update_branches_project_merge_requests_path(@source_project)}", {target_project_id: $(this).val() }); - }); - source_branch.on("change", function() { - $.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: $(this).val() }); - }); - target_branch.on("change", function() { - $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() }); - }); diff --git a/app/views/projects/merge_requests/branch_from.js.haml b/app/views/projects/merge_requests/branch_from.js.haml index 693c2057a0f..8372afa61b5 100644 --- a/app/views/projects/merge_requests/branch_from.js.haml +++ b/app/views/projects/merge_requests/branch_from.js.haml @@ -1,7 +1,2 @@ :plain $(".mr_source_commit").html("#{commit_to_html(@commit, @source_project, false)}"); - var mrTitle = $('#merge_request_title'); - - if(mrTitle.val().length == 0) { - mrTitle.val("#{params[:ref].titleize.humanize}"); - } diff --git a/app/views/projects/merge_requests/show/_mr_title.html.haml b/app/views/projects/merge_requests/show/_mr_title.html.haml index 8f78e93df4f..2c905413bc3 100644 --- a/app/views/projects/merge_requests/show/_mr_title.html.haml +++ b/app/views/projects/merge_requests/show/_mr_title.html.haml @@ -39,4 +39,4 @@ - else %span= @merge_request.source_branch → - %spanh= @merge_request.target_branch + %span= @merge_request.target_branch -- GitLab From ee3cd06f4cdf0c150801b1268d806b8a252960f5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:40:19 +0300 Subject: [PATCH 134/237] Remove unnecessary css margin Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/sections/merge_requests.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/app/assets/stylesheets/sections/merge_requests.scss b/app/assets/stylesheets/sections/merge_requests.scss index 790496a1a5a..5dcfc449b42 100644 --- a/app/assets/stylesheets/sections/merge_requests.scss +++ b/app/assets/stylesheets/sections/merge_requests.scss @@ -31,7 +31,6 @@ .mr_source_commit, .mr_target_commit { - margin-top: 10px; .commit { margin: 0; padding: 2px 0; -- GitLab From 2da289cf22995d14e275b7c908b7e6014a11c7d9 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:52:59 +0300 Subject: [PATCH 135/237] Add assignee and milestone to 2nd step Signed-off-by: Dmitriy Zaporozhets --- .../project_users_select.js.coffee | 2 +- app/helpers/issues_helper.rb | 2 +- app/helpers/selects_helper.rb | 4 ++-- .../projects/merge_requests/_form.html.haml | 4 ++++ .../merge_requests/_new_submit.html.haml | 22 +++++++++++++++++++ 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/project_users_select.js.coffee b/app/assets/javascripts/project_users_select.js.coffee index 03fad41c490..b0e39610feb 100644 --- a/app/assets/javascripts/project_users_select.js.coffee +++ b/app/assets/javascripts/project_users_select.js.coffee @@ -1,7 +1,7 @@ @projectUsersSelect = init: -> $('.ajax-project-users-select').each (i, select) -> - project_id = $('body').data('project-id') + project_id = $(select).data('project-id') || $('body').data('project-id') $(select).select2 placeholder: $(select).data('placeholder') || "Search for a user" diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 95f0eff58b1..7c58908165c 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -82,7 +82,7 @@ module IssuesHelper end def milestone_options object - options_from_collection_for_select(@project.milestones.active, 'id', 'title', object.milestone_id) + options_from_collection_for_select(object.project.milestones.active, 'id', 'title', object.milestone_id) end def issue_box_class(item) diff --git a/app/helpers/selects_helper.rb b/app/helpers/selects_helper.rb index a1fe4488ae9..ab24367c455 100644 --- a/app/helpers/selects_helper.rb +++ b/app/helpers/selects_helper.rb @@ -14,7 +14,7 @@ module SelectsHelper css_class << (opts[:class] || '') value = opts[:selected] || '' placeholder = opts[:placeholder] || 'Select user' - - hidden_field_tag(id, value, class: css_class, 'data-placeholder' => placeholder) + project_id = opts[:project_id] || @project.id + hidden_field_tag(id, value, class: css_class, 'data-placeholder' => placeholder, 'data-project-id' => project_id) end end diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml index 58994e012f9..ddff3dbead8 100644 --- a/app/views/projects/merge_requests/_form.html.haml +++ b/app/views/projects/merge_requests/_form.html.haml @@ -56,3 +56,7 @@ :javascript disableButtonIfEmptyField("#merge_request_title", ".btn-save"); + $('.assign-to-me-link').on('click', function(e){ + $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change"); + e.preventDefault(); + }); diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index ea79b78e76c..e6e0db55d92 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -25,6 +25,21 @@ = f.label :description, "Description" = f.text_area :description, class: "form-control js-gfm-input", rows: 10 %p.hint Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. + .form-group + .issue-assignee + = f.label :assignee_id do + %i.icon-user + Assign to + %div + = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id, project_id: @merge_request.target_project_id) +   + = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' + .form-group + .issue-milestone + = f.label :milestone_id do + %i.icon-time + Milestone + %div= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'}) .panel-footer - if @target_repo.contribution_guide - contribution_guide_url = project_blob_path(@target_project, tree_join(@target_repo.root_ref, @target_repo.contribution_guide.name)) @@ -58,3 +73,10 @@ .bs-callout.bs-callout-danger %h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits. %p To preserve performance the line changes are not shown. + + +:javascript + $('.assign-to-me-link').on('click', function(e){ + $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change"); + e.preventDefault(); + }); -- GitLab From 700b6366db9d4ee0bf8d6e9e0e47519ae46e40c6 Mon Sep 17 00:00:00 2001 From: Jeroen van Baarsen Date: Thu, 8 May 2014 14:57:42 +0200 Subject: [PATCH 136/237] Fix a minor typo in the README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cb755a411e8..c7c979c0caa 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ * [GitLab CI](https://www.gitlab.com/gitlab-ci/) is a continuous integration (CI) server that is easy to integrate with GitLab. -* Unofficial third-party [iPhone app](http://gitlabcontrol.com/)m [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) and [command line client](https://github.com/drewblessing/gitlab-cli) for GitLab. +* Unofficial third-party [iPhone app](http://gitlabcontrol.com/), [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) and [command line client](https://github.com/drewblessing/gitlab-cli) for GitLab. ### Requirements -- GitLab From 04561011177f5323f4fe0e18e7a0137d72b314ea Mon Sep 17 00:00:00 2001 From: "C. Morgan Hamill" Date: Thu, 8 May 2014 09:23:17 -0400 Subject: [PATCH 137/237] Clean up conditional statement in `name` method. Reverse the conditional order to avoid awkward `if !` construction. --- lib/gitlab/oauth/user.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb index e9e57aa5742..7f1d1cd6532 100644 --- a/lib/gitlab/oauth/user.rb +++ b/lib/gitlab/oauth/user.rb @@ -65,10 +65,10 @@ module Gitlab end def name - if !auth.info.name.nil? - auth.info.name.to_s.force_encoding('utf-8') - else + if auth.info.name.nil? "#{auth.info.first_name} #{auth.info.last_name}".force_encoding('utf-8') + else + auth.info.name.to_s.force_encoding('utf-8') end end -- GitLab From ad5a982d841f572e4e9207ae5ac6a0013648d30e Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 8 May 2014 15:00:20 +0200 Subject: [PATCH 138/237] Update sass-rails with newer version of rails. --- Gemfile | 2 +- Gemfile.lock | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 3563dc88e30..7ff7515143c 100644 --- a/Gemfile +++ b/Gemfile @@ -152,7 +152,7 @@ gem "rack-attack" # Ace editor gem 'ace-rails-ap' -gem "sass-rails" +gem "sass-rails", '~> 4.0.2' gem "coffee-rails" gem "uglifier" gem "therubyracer" diff --git a/Gemfile.lock b/Gemfile.lock index 20fcc3964a3..c04c1e2b565 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -427,11 +427,12 @@ GEM safe_yaml (0.9.7) sanitize (2.1.0) nokogiri (>= 1.4.4) - sass (3.2.12) - sass-rails (4.0.1) + sass (3.2.19) + sass-rails (4.0.3) railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0) + sass (~> 3.2.0) + sprockets (~> 2.8, <= 2.11.0) + sprockets-rails (~> 2.0) sdoc (0.3.20) json (>= 1.1.3) rdoc (~> 3.10) @@ -478,7 +479,7 @@ GEM spring (>= 0.9.1) spring-commands-spinach (1.0.0) spring (>= 0.9.1) - sprockets (2.12.1) + sprockets (2.11.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) @@ -636,7 +637,7 @@ DEPENDENCIES redis-rails rspec-rails sanitize (~> 2.0) - sass-rails + sass-rails (~> 4.0.2) sdoc seed-fu select2-rails -- GitLab From 86bf684f5dc95e8bd2445f088f862d0a0539922a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 16:30:39 +0300 Subject: [PATCH 139/237] Minor UI improvements and fixed test Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/merge_requests/_new_compare.html.haml | 6 +++--- app/views/projects/merge_requests/_new_submit.html.haml | 2 +- features/steps/project/merge_requests.rb | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml index 47b8e5c886c..6f6f54ccecb 100644 --- a/app/views/projects/merge_requests/_new_compare.html.haml +++ b/app/views/projects/merge_requests/_new_compare.html.haml @@ -1,4 +1,4 @@ -%h3.page-title Compare changes for new merge request +%h3.page-title Compare branches for new Merge Request %hr = form_for [@project, @merge_request], url: new_project_merge_request_path(@project), method: :get, html: { class: "merge-request-form form-inline" } do |f| @@ -45,8 +45,8 @@ %span.label-branch #{@merge_request.target_branch} are the same. - .form-actions - = f.submit 'Compare branches', class: "btn btn-primary" + %hr + = f.submit 'Compare branches', class: "btn btn-primary" :javascript var source_branch = $("#merge_request_source_branch") diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index e6e0db55d92..b5479be708b 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -51,7 +51,7 @@ = f.hidden_field :target_project_id = f.hidden_field :target_branch = f.hidden_field :source_branch - = f.submit 'Submit a merge request', class: "btn btn-create" + = f.submit 'Submit merge request', class: "btn btn-create" .mr-compare %div.ui-box diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb index f42eb6377ce..e0aec699a56 100644 --- a/features/steps/project/merge_requests.rb +++ b/features/steps/project/merge_requests.rb @@ -61,9 +61,10 @@ class ProjectMergeRequests < Spinach::FeatureSteps end step 'I submit new merge request "Wiki Feature"' do - fill_in "merge_request_title", with: "Wiki Feature" select "master", from: "merge_request_source_branch" select "notes_refactoring", from: "merge_request_target_branch" + click_button "Compare branches" + fill_in "merge_request_title", with: "Wiki Feature" click_button "Submit merge request" end -- GitLab From 536373ad05b55c69442e7d7d6cb549791031cac2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 19:00:03 +0300 Subject: [PATCH 140/237] Dont allow mr compare with empty branches Signed-off-by: Dmitriy Zaporozhets --- .../merge_requests/_new_compare.html.haml | 21 ++++++++++++++++--- .../project/forked_merge_requests.feature | 3 +-- .../steps/project/forked_merge_requests.rb | 15 +++---------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml index 6f6f54ccecb..a8b774a3cd1 100644 --- a/app/views/projects/merge_requests/_new_compare.html.haml +++ b/app/views/projects/merge_requests/_new_compare.html.haml @@ -2,11 +2,12 @@ %hr = form_for [@project, @merge_request], url: new_project_merge_request_path(@project), method: :get, html: { class: "merge-request-form form-inline" } do |f| + .hide.alert.alert-danger.mr-compare-errors .merge-request-branches.row .col-md-6 .panel.panel-default .panel-heading - From + %strong Source branch .panel-body = f.select(:source_project_id, [[@merge_request.source_project_path,@merge_request.source_project.id]] , {}, { class: 'source_project select2 span3', disabled: @merge_request.persisted? })   @@ -17,7 +18,7 @@ .col-md-6 .panel.panel-default .panel-heading - To + %strong Target branch .panel-body - projects = @project.forked_from_project.nil? ? [@project] : [@project, @project.forked_from_project] = f.select(:target_project_id, options_from_collection_for_select(projects, 'id', 'path_with_namespace', f.object.target_project_id), {}, { class: 'target_project select2 span3', disabled: @merge_request.persisted? }) @@ -45,8 +46,9 @@ %span.label-branch #{@merge_request.target_branch} are the same. + %hr - = f.submit 'Compare branches', class: "btn btn-primary" + = f.submit 'Compare branches', class: "btn btn-primary mr-compare-btn" :javascript var source_branch = $("#merge_request_source_branch") @@ -61,9 +63,22 @@ }); source_branch.on("change", function() { $.get("#{branch_from_project_merge_requests_path(@source_project)}", {ref: $(this).val() }); + $(".mr-compare-errors").fadeOut(); + $(".mr-compare-btn").enable(); }); target_branch.on("change", function() { $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() }); + $(".mr-compare-errors").fadeOut(); + $(".mr-compare-btn").enable(); }); +:coffeescript + + $(".merge-request-form").on 'submit', -> + if $("#merge_request_source_branch").val() is "" or $('#merge_request_target_branch').val() is "" + $(".mr-compare-errors").html("You must select source and target branch to proceed") + $(".mr-compare-errors").fadeIn() + event.preventDefault() + return + diff --git a/features/project/forked_merge_requests.feature b/features/project/forked_merge_requests.feature index 2d94b98c90b..5832b729deb 100644 --- a/features/project/forked_merge_requests.feature +++ b/features/project/forked_merge_requests.feature @@ -30,11 +30,10 @@ Feature: Project Forked Merge Requests Given I visit project "Forked Shop" merge requests page And I click link "New Merge Request" And I fill out an invalid "Merge Request On Forked Project" merge request - And I submit the merge request Then I should see validation errors @javascript Scenario: Merge request should target fork repository by default Given I visit project "Forked Shop" merge requests page And I click link "New Merge Request" - Then the target repository should be the original repository \ No newline at end of file + Then the target repository should be the original repository diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb index df69cb75437..3c497638d9c 100644 --- a/features/steps/project/forked_merge_requests.rb +++ b/features/steps/project/forked_merge_requests.rb @@ -53,6 +53,7 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps find(:select, "merge_request_source_branch", {}).value.should == 'master' find(:select, "merge_request_target_branch", {}).value.should == 'stable' + click_button "Compare branches" fill_in "merge_request_title", with: "Merge Request On Forked Project" end @@ -148,29 +149,19 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps current_path.should == edit_project_merge_request_path(@project, @merge_request) page.should have_content "Edit merge request ##{@merge_request.id}" find("#merge_request_title").value.should == "Merge Request On Forked Project" - find("#merge_request_source_project_id").value.should == @forked_project.id.to_s - find("#merge_request_target_project_id").value.should == @project.id.to_s - find("#merge_request_source_branch").value.should have_content "master" - verify_commit_link(".mr_source_commit",@forked_project) - find("#merge_request_target_branch").value.should have_content "stable" - verify_commit_link(".mr_target_commit",@project) end step 'I fill out an invalid "Merge Request On Forked Project" merge request' do - #If this isn't filled in the rest of the validations won't be triggered - fill_in "merge_request_title", with: "Merge Request On Forked Project" - select "Select branch", from: "merge_request_target_branch" - find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s find(:select, "merge_request_target_project_id", {}).value.should == project.id.to_s find(:select, "merge_request_source_branch", {}).value.should == "" find(:select, "merge_request_target_branch", {}).value.should == "" + click_button "Compare branches" end step 'I should see validation errors' do - page.should have_content "Source branch can't be blank" - page.should have_content "Target branch can't be blank" + page.should have_content "You must select source and target branch" end step 'the target repository should be the original repository' do -- GitLab From 41231862baeb01dc6ed49f68488e863bca6dbfb2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 19:23:39 +0300 Subject: [PATCH 141/237] Fix tests Signed-off-by: Dmitriy Zaporozhets --- features/steps/dashboard/dashboard.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index 394acd3fe8f..706c9babcee 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -25,7 +25,6 @@ class Dashboard < Spinach::FeatureSteps find("#merge_request_target_project_id").value.should == @project.id.to_s find("#merge_request_source_branch").value.should == "new_design" find("#merge_request_target_branch").value.should == "master" - find("#merge_request_title").value.should == "New design" end Given 'user with name "John Doe" joined project "Shop"' do -- GitLab From da347d1bb45ad3b08b2aa0b40041c67dac0df3c5 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 11:02:04 +0200 Subject: [PATCH 142/237] Apply the locale encoding to `tar --version` Fixes a bug with non-UTF8 locales introduced by 2b816075dc71dfe8f6f9e5349fdff7f03ad9dad0. --- CHANGELOG | 1 + lib/backup/manager.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index cc271f5e2cd..61eb24f1c53 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ v 6.9.0 - Stop refreshing comments when the tab is hidden - Improve issue and merge request mobile UI (Drew Blessing) - Document how to convert a backup to PostgreSQL + - Fix locale bug in backup manager v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion diff --git a/lib/backup/manager.rb b/lib/backup/manager.rb index 05814fc78f6..28e323fe30d 100644 --- a/lib/backup/manager.rb +++ b/lib/backup/manager.rb @@ -101,7 +101,7 @@ module Backup def tar_version tar_version, _ = Gitlab::Popen.popen(%W(tar --version)) - tar_version.split("\n").first + tar_version.force_encoding('locale').split("\n").first end end end -- GitLab From 20be9ef251ff0d1e865f1ec5090ee151a24135bb Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 21:09:51 +0300 Subject: [PATCH 143/237] Remove old mixins Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/main/mixins.scss | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/app/assets/stylesheets/main/mixins.scss b/app/assets/stylesheets/main/mixins.scss index fcc7374d0d9..147c759ecb8 100644 --- a/app/assets/stylesheets/main/mixins.scss +++ b/app/assets/stylesheets/main/mixins.scss @@ -41,31 +41,6 @@ * Prefilled mixins * Mixins with fixed values */ -@mixin bg-light-gray-gradient { - background: #f1f1f1; - background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #f5f5f5), to(#e1e1e1)); - background-image: -webkit-linear-gradient(#f5f5f5 6.6%, #e1e1e1); - background-image: -moz-linear-gradient(#f5f5f5 6.6%, #e1e1e1); - background-image: -ms-linear-gradient(#f5f5f5 6.6%, #e1e1e1); - background-image: -o-linear-gradient(#f5f5f5 6.6%, #e1e1e1); -} - -@mixin bg-gray-gradient { - background: #eee; - background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf)); - background-image: -webkit-linear-gradient(#eee 6.6%, #dfdfdf); - background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf); - background-image: -ms-linear-gradient(#eee 6.6%, #dfdfdf); - background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf); -} - -@mixin bg-dark-gray-gradient { - background: #eee; - background-image: -webkit-linear-gradient(#e9e9e9, #d7d7d7); - background-image: -moz-linear-gradient(#e9e9e9, #d7d7d7); - background-image: -ms-linear-gradient(#e9e9e9, #d7d7d7); - background-image: -o-linear-gradient(#e9e9e9, #d7d7d7); -} @mixin shade { @include box-shadow(0 0 3px #ddd); -- GitLab From 2ec1a879f7cb96370a54f379c39a88b75b67f4c7 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 21:10:07 +0300 Subject: [PATCH 144/237] Add box shadow to issue box Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/issue_box.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/stylesheets/generic/issue_box.scss b/app/assets/stylesheets/generic/issue_box.scss index ccdcc657946..d4d3361bc72 100644 --- a/app/assets/stylesheets/generic/issue_box.scss +++ b/app/assets/stylesheets/generic/issue_box.scss @@ -12,6 +12,7 @@ margin:20px 0; background: #FFF; border: 1px solid #EEE; + @include box-shadow(0 1px 1px rgba(0, 0, 0, 0.05)); &.issue-box-closed { border-color: #DA4E49; -- GitLab From 211e975d8acbc046219fefbf95a12a8f0bbf980b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 21:10:20 +0300 Subject: [PATCH 145/237] Change header color in network page Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/sections/graph.scss | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/sections/graph.scss b/app/assets/stylesheets/sections/graph.scss index 1e22d161bfc..8a337a5e206 100644 --- a/app/assets/stylesheets/sections/graph.scss +++ b/app/assets/stylesheets/sections/graph.scss @@ -1,17 +1,16 @@ .project-network { - border: 1px solid #aaa; - padding: 1px; + border: 1px solid #CCC; .tip { color: #888; font-size: 14px; padding: 10px; border-bottom: 1px solid #bbb; - @include bg-gray-gradient; + background: #EEE; } .network-graph { - background: #f1f1f1; + background: #FFF; height: 500px; overflow-y: scroll; overflow-x: hidden; -- GitLab From 0f29ccffd2b9805545db63d8266bb8367de1e35c Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 22:49:27 +0200 Subject: [PATCH 146/237] Backup wiki repo even if the main repo is empty This fixes a bug where wiki repositories for projects with an empty main repository would not get backed up. --- CHANGELOG | 1 + lib/backup/repository.rb | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 61eb24f1c53..e43edc5d7ad 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,7 @@ v 6.9.0 - Improve issue and merge request mobile UI (Drew Blessing) - Document how to convert a backup to PostgreSQL - Fix locale bug in backup manager + - Fix wiki backup skip bug v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb index 214d9824ee1..6f7c4f7c909 100644 --- a/lib/backup/repository.rb +++ b/lib/backup/repository.rb @@ -10,15 +10,12 @@ module Backup Project.find_each(batch_size: 1000) do |project| print " * #{project.path_with_namespace} ... " - if project.empty_repo? - puts "[SKIPPED]".cyan - next - end - # Create namespace dir if missing FileUtils.mkdir_p(File.join(backup_repos_path, project.namespace.path)) if project.namespace - if system(*%W(git --git-dir=#{path_to_repo(project)} bundle create #{path_to_bundle(project)} --all), silent) + if project.empty_repo? + puts "[SKIPPED]".cyan + elsif system(*%W(git --git-dir=#{path_to_repo(project)} bundle create #{path_to_bundle(project)} --all), silent) puts "[DONE]".green else puts "[FAILED]".red -- GitLab From 3b34084bdeadecdceb0a86e2820dd7c5985099f6 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 9 May 2014 09:46:23 +0300 Subject: [PATCH 147/237] Fix notify specs Signed-off-by: Dmitriy Zaporozhets --- spec/mailers/notify_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index e86a60a42b5..3b075044955 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -239,7 +239,7 @@ describe Notify do it_behaves_like 'an assignee email' it 'has the correct subject' do - should have_subject /#{merge_request.title} \(!#{merge_request.iid}\)/ + should have_subject /#{merge_request.title} \(##{merge_request.iid}\)/ end it 'contains a link to the new merge request' do @@ -275,7 +275,7 @@ describe Notify do end it 'has the correct subject' do - should have_subject /#{merge_request.title} \(!#{merge_request.iid}\)/ + should have_subject /#{merge_request.title} \(##{merge_request.iid}\)/ end it 'contains the name of the previous assignee' do @@ -303,7 +303,7 @@ describe Notify do end it 'has the correct subject' do - should have_subject /#{merge_request.title} \(!#{merge_request.iid}\)/ + should have_subject /#{merge_request.title} \(##{merge_request.iid}\)/ end it 'contains the new status' do @@ -426,7 +426,7 @@ describe Notify do it_behaves_like 'a note email' it 'has the correct subject' do - should have_subject /#{merge_request.title} \(!#{merge_request.iid}\)/ + should have_subject /#{merge_request.title} \(##{merge_request.iid}\)/ end it 'contains a link to the merge request note' do -- GitLab From ea696805a7a82ec6a70da1dd7d5bc010f035ea26 Mon Sep 17 00:00:00 2001 From: Gregoire Daussin Date: Fri, 9 May 2014 17:58:23 +0200 Subject: [PATCH 148/237] Fix css rules conflict between .dark & a.dark classes --- app/assets/stylesheets/generic/typography.scss | 2 +- app/views/projects/milestones/show.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/generic/typography.scss b/app/assets/stylesheets/generic/typography.scss index a4419551738..8cc72d7f07a 100644 --- a/app/assets/stylesheets/generic/typography.scss +++ b/app/assets/stylesheets/generic/typography.scss @@ -47,7 +47,7 @@ a { text-decoration: underline; } - &.dark { + &.darken { color: $style_color; } diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 06cf9946784..5c5df46d33d 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -100,7 +100,7 @@ %ul.bordered-list - @users.each do |user| %li - = link_to user, title: user.name, class: "dark" do + = link_to user, title: user.name, class: "darken" do = image_tag avatar_icon(user.email, 32), class: "avatar s32" %strong= truncate(user.name, lenght: 40) %br -- GitLab From 049b63473f827e3d28b0128356b81b3208bf0b0c Mon Sep 17 00:00:00 2001 From: dosire Date: Fri, 9 May 2014 19:34:25 +0200 Subject: [PATCH 149/237] Link to the installation doc so people viewing on other locations can click the link. --- doc/install/installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index a2aa9add9ad..eea5c763fcd 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -1,10 +1,10 @@ # Select Version to Install -Make sure you view this installation guide from the branch (version) of GitLab you would like to install. In most cases +Make sure you view [this installation guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md) from the branch (version) of GitLab you would like to install. In most cases this should be the highest numbered stable branch (example shown below). ![capture](http://i.imgur.com/d2AlIVj.png) -If this is unclear check the [GitLab Blog](https://www.gitlab.com/blog/) for installation guide links by version. +If the highest number stable branch is unclear please check the [GitLab Blog](https://www.gitlab.com/blog/) for installation guide links by version. # Important notes -- GitLab From 7477dd7a7ca68b6f5365068e34c854381096da3c Mon Sep 17 00:00:00 2001 From: Pascal Herbert Date: Sun, 11 May 2014 13:23:51 +0000 Subject: [PATCH 150/237] Fix typo --- doc/install/requirements.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/install/requirements.md b/doc/install/requirements.md index 0fe015b2d34..dc21a7e55ab 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -82,6 +82,6 @@ If you want to run the database separately, the **recommended** database size is - Chrome (Latest stable version) - Firefox (Latest released version) -- Safari 7+ (Know problem: required fields in html5 do not work) +- Safari 7+ (known problem: required fields in html5 do not work) - Opera (Latest released version) -- IE 10+ +- IE 10+ \ No newline at end of file -- GitLab From a3d8be09c6c62e39301d82e47b710717ff68245f Mon Sep 17 00:00:00 2001 From: sue445 Date: Fri, 18 Apr 2014 00:13:31 +0900 Subject: [PATCH 151/237] Fix can not automerge if description is too long --- CHANGELOG | 1 + .../projects/merge_requests/show/_mr_accept.html.haml | 2 +- config/routes.rb | 2 +- spec/routing/project_routing_spec.rb | 7 +++++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e43edc5d7ad..3188b6e9628 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,7 @@ v 6.9.0 - Improve issue and merge request mobile UI (Drew Blessing) - Document how to convert a backup to PostgreSQL - Fix locale bug in backup manager + - Fix can not automerge when MR description is too long - Fix wiki backup skip bug v 6.8.0 diff --git a/app/views/projects/merge_requests/show/_mr_accept.html.haml b/app/views/projects/merge_requests/show/_mr_accept.html.haml index 6594709f2ae..6ca801b17b9 100644 --- a/app/views/projects/merge_requests/show/_mr_accept.html.haml +++ b/app/views/projects/merge_requests/show/_mr_accept.html.haml @@ -12,7 +12,7 @@ - if @show_merge_controls .automerge_widget.can_be_merged.hide .clearfix - = form_for [:automerge, @project, @merge_request], remote: true, method: :get do |f| + = form_for [:automerge, @project, @merge_request], remote: true, method: :post do |f| %h4 You can accept this request automatically. %div diff --git a/config/routes.rb b/config/routes.rb index 7a33686b810..7641fe43088 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -273,7 +273,7 @@ Gitlab::Application.routes.draw do resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do member do get :diffs - get :automerge + post :automerge get :automerge_check get :ci_status end diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 97f7392e50a..fa9762625d7 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -213,7 +213,7 @@ describe Projects::RefsController, "routing" do end # diffs_project_merge_request GET /:project_id/merge_requests/:id/diffs(.:format) projects/merge_requests#diffs -# automerge_project_merge_request GET /:project_id/merge_requests/:id/automerge(.:format) projects/merge_requests#automerge +# automerge_project_merge_request POST /:project_id/merge_requests/:id/automerge(.:format) projects/merge_requests#automerge # automerge_check_project_merge_request GET /:project_id/merge_requests/:id/automerge_check(.:format) projects/merge_requests#automerge_check # branch_from_project_merge_requests GET /:project_id/merge_requests/branch_from(.:format) projects/merge_requests#branch_from # branch_to_project_merge_requests GET /:project_id/merge_requests/branch_to(.:format) projects/merge_requests#branch_to @@ -230,7 +230,10 @@ describe Projects::MergeRequestsController, "routing" do end it "to #automerge" do - get("/gitlab/gitlabhq/merge_requests/1/automerge").should route_to('projects/merge_requests#automerge', project_id: 'gitlab/gitlabhq', id: '1') + post('/gitlab/gitlabhq/merge_requests/1/automerge').should route_to( + 'projects/merge_requests#automerge', + project_id: 'gitlab/gitlabhq', id: '1' + ) end it "to #automerge_check" do -- GitLab From 566badbaee55b7df45c7d912f80c372b6118b6ee Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Fri, 9 May 2014 11:37:27 +0200 Subject: [PATCH 152/237] Use uid as username when creating user with LDAP Without that commit, each user created by a LDAP login would have the first part of their email address as nickname. This is not useful for LDAP, where a uid attribute is already set. --- lib/gitlab/oauth/user.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb index 7f1d1cd6532..d154bd8600b 100644 --- a/lib/gitlab/oauth/user.rb +++ b/lib/gitlab/oauth/user.rb @@ -34,9 +34,11 @@ module Gitlab # In this case we generate temporary email and force user to fill it later if user.email.blank? user.generate_tmp_oauth_email - else + elsif provider != "ldap" # Google oauth returns email but dont return nickname # So we use part of email as username for new user + # For LDAP, username is already set to the user's + # uid/userid/sAMAccountName. user.username = email.match(/^[^@]*/)[0] end -- GitLab From 31b0e14981d57c2f38734872181c6dc49a2e6f5a Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 12 May 2014 10:23:24 +0100 Subject: [PATCH 153/237] Adding project visibility to system hooks --- app/services/system_hooks_service.rb | 6 ++-- doc/system_hooks/system_hooks.md | 36 ++++++++++++---------- spec/services/system_hooks_service_spec.rb | 8 ++--- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb index 4969198b8c2..41014f199d5 100644 --- a/app/services/system_hooks_service.rb +++ b/app/services/system_hooks_service.rb @@ -31,7 +31,8 @@ class SystemHooksService path_with_namespace: model.path_with_namespace, project_id: model.id, owner_name: owner.name, - owner_email: owner.respond_to?(:email) ? owner.email : nil + owner_email: owner.respond_to?(:email) ? owner.email : nil, + project_visibility: Project.visibility_levels.key(model.visibility_level_field).downcase }) when User data.merge!({ @@ -46,7 +47,8 @@ class SystemHooksService project_id: model.project_id, user_name: model.user.name, user_email: model.user.email, - project_access: model.human_access + project_access: model.human_access, + project_visibility: Project.visibility_levels.key(model.project.visibility_level_field).downcase }) end end diff --git a/doc/system_hooks/system_hooks.md b/doc/system_hooks/system_hooks.md index 76ca2a59911..5c8daf466ab 100644 --- a/doc/system_hooks/system_hooks.md +++ b/doc/system_hooks/system_hooks.md @@ -16,6 +16,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser "path": "stormcloud", "path_with_namespace": "jsmith/stormcloud", "project_id": 74, + "project_visibility": "private", } ``` @@ -31,6 +32,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser "path": "underscore", "path_with_namespace": "jsmith/underscore", "project_id": 73, + "project_visibility": "internal", } ``` @@ -38,14 +40,15 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser ```json { - "created_at": "2012-07-21T07:30:56Z", - "event_name": "user_add_to_team", - "project_access": "Master", - "project_id": 74, - "project_name": "StoreCloud", - "project_path": "storecloud", - "user_email": "johnsmith@gmail.com", - "user_name": "John Smith", + "created_at": "2012-07-21T07:30:56Z", + "event_name": "user_add_to_team", + "project_access": "Master", + "project_id": 74, + "project_name": "StoreCloud", + "project_path": "storecloud", + "user_email": "johnsmith@gmail.com", + "user_name": "John Smith", + "project_visibility": "private", } ``` @@ -53,14 +56,15 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser ```json { - "created_at": "2012-07-21T07:30:56Z", - "event_name": "user_remove_from_team", - "project_access": "Master", - "project_id": 74, - "project_name": "StoreCloud", - "project_path": "storecloud", - "user_email": "johnsmith@gmail.com", - "user_name": "John Smith", + "created_at": "2012-07-21T07:30:56Z", + "event_name": "user_remove_from_team", + "project_access": "Master", + "project_id": 74, + "project_name": "StoreCloud", + "project_path": "storecloud", + "user_email": "johnsmith@gmail.com", + "user_name": "John Smith", + "project_visibility": "private", } ``` diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb index f1df7e55dd0..3c2eec6cfd9 100644 --- a/spec/services/system_hooks_service_spec.rb +++ b/spec/services/system_hooks_service_spec.rb @@ -8,10 +8,10 @@ describe SystemHooksService do context 'event data' do it { event_data(user, :create).should include(:event_name, :name, :created_at, :email, :user_id) } it { event_data(user, :destroy).should include(:event_name, :name, :created_at, :email, :user_id) } - it { event_data(project, :create).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email) } - it { event_data(project, :destroy).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email) } - it { event_data(users_project, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access) } - it { event_data(users_project, :destroy).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access) } + it { event_data(project, :create).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) } + it { event_data(project, :destroy).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) } + it { event_data(users_project, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) } + it { event_data(users_project, :destroy).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) } end context 'event names' do -- GitLab From 8b9b34f8427766c0eac65e6b16a7437acd5fcb9b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 12 May 2014 13:06:25 +0300 Subject: [PATCH 154/237] Mention 2 step MR in CHANGELOG Signed-off-by: Dmitriy Zaporozhets --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index e43edc5d7ad..82395198f42 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,7 @@ v 6.9.0 - Document how to convert a backup to PostgreSQL - Fix locale bug in backup manager - Fix wiki backup skip bug + - Two Step MR creation process v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion -- GitLab From 2efcd3013a22555965a01d170c2b3a7775d92280 Mon Sep 17 00:00:00 2001 From: dosire Date: Mon, 12 May 2014 13:57:20 +0200 Subject: [PATCH 155/237] Add changelog entry for satellite clean. --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 82395198f42..72bd6984869 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,7 @@ v 6.9.0 - Fix locale bug in backup manager - Fix wiki backup skip bug - Two Step MR creation process + - Remove unwanted files from satellite working directory with git clean -fdx v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion -- GitLab From fe6d392236fb6f1edd5dc1c33d52806cb4fa8a39 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 12 May 2014 16:34:41 +0300 Subject: [PATCH 156/237] Draft API method for merge MR Signed-off-by: Dmitriy Zaporozhets --- lib/api/merge_requests.rb | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 4b88b0f84c1..fe615dfac05 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -111,6 +111,45 @@ module API end end + # Merge MR + # + # Parameters: + # id (required) - The ID of a project + # merge_request_id (required) - ID of MR + # merge_commit_message (optional) - Custom merge commit message + # Example: + # PUT /projects/:id/merge_request/:merge_request_id/merge + # + put ":id/merge_request/:merge_request_id/merge" do + merge_request = user_project.merge_requests.find(params[:merge_request_id]) + + action = if user_project.protected_branch?(merge_request.target_branch) + :push_code_to_protected_branches + else + :push_code + end + + if can?(current_user, action, project) + # Check if MR can be merged by GitLab + if merge_request.unchecked? + merge_request.check_if_can_be_merged + end + + if merge_request.open? && merge_request.can_be_merged? + merge_request.automerge!(current_user, params[:merge_commit_message] || merge_request.merge_commit_message) + + # return success + else + + # Checkif can be merged + end + + else + # not allowed + end + end + + # Get a merge request's comments # # Parameters: -- GitLab From 78897ee2d2ecb6db40139ed3af1b591d96f59387 Mon Sep 17 00:00:00 2001 From: dtan4 Date: Mon, 12 May 2014 21:00:04 +0900 Subject: [PATCH 157/237] Fix dead links in ruby.md --- doc/update/ruby.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/update/ruby.md b/doc/update/ruby.md index 9d0cafb3f05..e98167f6b66 100644 --- a/doc/update/ruby.md +++ b/doc/update/ruby.md @@ -1,6 +1,6 @@ # Updating Ruby from source -This guide explains how to update Ruby in case you installed it from source according to the instructions in https://gitlab.com/gitlab-org/gitlab-ce/blob/masterdoc/install/installation.md#2-ruby . +This guide explains how to update Ruby in case you installed it from source according to the [instructions](../install/installation.md#2-ruby). ### 1. Look for Ruby versions This guide will only update `/usr/local/bin/ruby`. You can see which Ruby binaries are installed on your system by running: @@ -36,7 +36,7 @@ sudo gem install bundler ``` ### 5. Reinstall GitLab gem bundle -Just to be sure we will reinstall the gems used by GitLab. Note that the `bundle install` command [depends on your choice of database](https://gitlab.com/gitlab-org/gitlab-ce/blob/masterdoc/install/installation.md#install-gems). +Just to be sure we will reinstall the gems used by GitLab. Note that the `bundle install` command [depends on your choice of database](../install/installation.md#install-gems). ```bash cd /home/git/gitlab -- GitLab From 0c73e6664389ef5af352560c2fced1fbfc650a27 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 12 May 2014 17:51:43 +0300 Subject: [PATCH 158/237] Specify error codes for merge api Signed-off-by: Dmitriy Zaporozhets --- lib/api/merge_requests.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index fe615dfac05..f9a4037dd26 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -130,22 +130,25 @@ module API end if can?(current_user, action, project) - # Check if MR can be merged by GitLab if merge_request.unchecked? merge_request.check_if_can_be_merged end - if merge_request.open? && merge_request.can_be_merged? - merge_request.automerge!(current_user, params[:merge_commit_message] || merge_request.merge_commit_message) - - # return success + if merge_request.open? + if merge_request.can_be_merged? + merge_request.automerge!(current_user, params[:merge_commit_message] || merge_request.merge_commit_message) + else + render_api_error!('Branch cannot be merged', 405) + end else - - # Checkif can be merged + # Merge request can not be merged + # because it is already closed/merged + not_allowed! end - else - # not allowed + # Merge request can not be merged + # because user dont have permissions to push into target branch + unauthorized! end end -- GitLab From 5880d7df6253fc97024005e7c32dbc41def99aaf Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 12 May 2014 18:01:22 +0300 Subject: [PATCH 159/237] Docs for merge api Signed-off-by: Dmitriy Zaporozhets --- doc/api/merge_requests.md | 48 +++++++++++++++++++++++++++++++++++++++ lib/api/merge_requests.rb | 1 + 2 files changed, 49 insertions(+) diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index d5b106729c9..d68f34971f1 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -189,6 +189,54 @@ Parameters: ``` +## Accept MR + +Merge changes submitted with MR usign this API. +If merge success you get 200 OK. +If it has some conflicts and can not be merged - you get 405 and error message 'Branch cannot be merged' +If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed' +If you dont have permissions to accept this merge request - you get 401 + +``` +PUT /projects/:id/merge_request/:merge_request_id/merge +``` + +Parameters: + ++ `id` (required) - The ID of a project ++ `merge_request_id` (required) - ID of MR ++ `merge_commit_message` (optional) - Custom merge commit message + +```json +{ + "id": 1, + "target_branch": "master", + "source_branch": "test1", + "project_id": 3, + "title": "test1", + "state": "merged", + "upvotes": 0, + "downvotes": 0, + "author": { + "id": 1, + "username": "admin", + "email": "admin@local.host", + "name": "Administrator", + "state": "active", + "created_at": "2012-04-29T08:46:00Z" + }, + "assignee": { + "id": 1, + "username": "admin", + "email": "admin@local.host", + "name": "Administrator", + "state": "active", + "created_at": "2012-04-29T08:46:00Z" + } +} +``` + + ## Post comment to MR Adds a comment to a merge request. diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index f9a4037dd26..3dffe7bd4df 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -137,6 +137,7 @@ module API if merge_request.open? if merge_request.can_be_merged? merge_request.automerge!(current_user, params[:merge_commit_message] || merge_request.merge_commit_message) + present merge_request, with: Entities::MergeRequest else render_api_error!('Branch cannot be merged', 405) end -- GitLab From f0e46ec9178bfa51034a27067ecbf14ad97f3a37 Mon Sep 17 00:00:00 2001 From: dosire Date: Tue, 13 May 2014 07:58:12 +0200 Subject: [PATCH 160/237] Let people know that Nihad Abbasov made a nice api wrapper. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c7c979c0caa..ca7bec3b6d6 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ * [GitLab CI](https://www.gitlab.com/gitlab-ci/) is a continuous integration (CI) server that is easy to integrate with GitLab. -* Unofficial third-party [iPhone app](http://gitlabcontrol.com/), [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) and [command line client](https://github.com/drewblessing/gitlab-cli) for GitLab. +* Unofficial third-party [iPhone app](http://gitlabcontrol.com/), [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) and [command line client](https://github.com/drewblessing/gitlab-cli) and [Ruby API wrapper](https://github.com/NARKOZ/gitlab) for GitLab. ### Requirements -- GitLab From ab032256da9f24351871143058343f7463f9d7fc Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 11:01:40 +0300 Subject: [PATCH 161/237] Add some tests for merge API Signed-off-by: Dmitriy Zaporozhets --- CHANGELOG | 1 + lib/api/merge_requests.rb | 4 ++-- spec/requests/api/merge_requests_spec.rb | 15 +++++++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 72bd6984869..91a7a22fe1b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,7 @@ v 6.9.0 - Fix wiki backup skip bug - Two Step MR creation process - Remove unwanted files from satellite working directory with git clean -fdx + - Accept merge request via API (sponsored by O'Reilly Media) v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 3dffe7bd4df..7fb135b37b8 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -34,7 +34,7 @@ module API when "closed" then user_project.merge_requests.closed when "merged" then user_project.merge_requests.merged else user_project.merge_requests - end + end present paginate(mrs), with: Entities::MergeRequest end @@ -129,7 +129,7 @@ module API :push_code end - if can?(current_user, action, project) + if can?(current_user, action, user_project) if merge_request.unchecked? merge_request.check_if_can_be_merged end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index db7c30e1ab8..b47cbbee773 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -183,11 +183,18 @@ describe API::API, api: true do end end - describe "PUT /projects/:id/merge_request/:merge_request_id to merge MR" do - it "should return merge_request" do - put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), state_event: "merge" + describe "PUT /projects/:id/merge_request/:merge_request_id/merge" do + it "should return merge_request in case of success" do + MergeRequest.any_instance.stub(can_be_merged?: true, automerge!: true) + put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user) response.status.should == 200 - json_response['state'].should == 'merged' + end + + it "should return 405 if branch can't be merged" do + MergeRequest.any_instance.stub(can_be_merged?: false) + put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user) + response.status.should == 405 + json_response['message'].should == 'Branch cannot be merged' end end -- GitLab From 2d2b2da45a586bdf29e115dcb4b4f66f9a1feed0 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 13:20:10 +0300 Subject: [PATCH 162/237] More tests for merge api Signed-off-by: Dmitriy Zaporozhets --- spec/requests/api/merge_requests_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index b47cbbee773..2fb3684fdf0 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -196,6 +196,21 @@ describe API::API, api: true do response.status.should == 405 json_response['message'].should == 'Branch cannot be merged' end + + it "should return 405 if merge_request is not open" do + merge_request.close + put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user) + response.status.should == 405 + json_response['message'].should == 'Method Not Allowed' + end + + it "should return 401 if user has no permissions to merge" do + user2 = create(:user) + project.team << [user2, :reporter] + put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user2) + response.status.should == 401 + json_response['message'].should == '401 Unauthorized' + end end describe "PUT /projects/:id/merge_request/:merge_request_id" do -- GitLab From 5f25cdfe19c7c0a8c1ada592307e9017e2a754e1 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Mon, 14 Apr 2014 20:12:07 -0500 Subject: [PATCH 163/237] Implement Merge Request Labels --- .../stylesheets/sections/merge_requests.scss | 8 +++ app/controllers/application_controller.rb | 5 ++ app/controllers/projects/labels_controller.rb | 13 +++-- app/models/merge_request.rb | 7 ++- app/models/project.rb | 5 +- app/views/projects/issues/index.html.haml | 3 +- .../projects/merge_requests/_form.html.haml | 38 ++++++++++++++ .../merge_requests/_merge_request.html.haml | 6 +++ .../projects/merge_requests/_show.html.haml | 1 + .../projects/merge_requests/index.html.haml | 3 +- .../show/_participants.html.haml | 11 ++++ app/views/shared/_project_filter.html.haml | 2 +- lib/api/entities.rb | 1 + lib/api/merge_requests.rb | 4 ++ spec/requests/api/projects_spec.rb | 52 ++++++++++++++++--- 15 files changed, 142 insertions(+), 17 deletions(-) create mode 100644 app/views/projects/merge_requests/show/_participants.html.haml diff --git a/app/assets/stylesheets/sections/merge_requests.scss b/app/assets/stylesheets/sections/merge_requests.scss index 790496a1a5a..82a8ff48333 100644 --- a/app/assets/stylesheets/sections/merge_requests.scss +++ b/app/assets/stylesheets/sections/merge_requests.scss @@ -74,6 +74,10 @@ .merge-request-info { color: #999; + + .merge-request-labels { + display: inline-block; + } } } } @@ -112,3 +116,7 @@ } } } + +.merge-request-show-labels .label { + padding: 6px 10px; +} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a3f39c23e08..2730e9942ec 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -117,6 +117,11 @@ class ApplicationController < ActionController::Base return access_denied! unless can?(current_user, :push_code, project) end + def authorize_labels! + # Labels should be accessible for issues and/or merge requests + authorize_read_issue! || authorize_read_merge_request! + end + def access_denied! render "errors/access_denied", layout: "errors", status: 404 end diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb index 0166ca9ff00..b037cf56502 100644 --- a/app/controllers/projects/labels_controller.rb +++ b/app/controllers/projects/labels_controller.rb @@ -1,8 +1,7 @@ class Projects::LabelsController < Projects::ApplicationController before_filter :module_enabled - # Allow read any issue - before_filter :authorize_read_issue! + before_filter :authorize_labels! respond_to :js, :html @@ -13,12 +12,18 @@ class Projects::LabelsController < Projects::ApplicationController def generate Gitlab::IssuesLabels.generate(@project) - redirect_to project_issues_path(@project) + if params[:redirect] == 'issues' + redirect_to project_issues_path(@project) + elsif params[:redirect] == 'merge_requests' + redirect_to project_merge_requests_path(@project) + end end protected def module_enabled - return render_404 unless @project.issues_enabled + unless @project.issues_enabled || @project.merge_requests_enabled + return render_404 + end end end diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 8c885b70a48..a55f3a61398 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -36,7 +36,9 @@ class MergeRequest < ActiveRecord::Base delegate :commits, :diffs, :last_commit, :last_commit_short_sha, to: :merge_request_diff, prefix: nil - attr_accessible :title, :assignee_id, :source_project_id, :source_branch, :target_project_id, :target_branch, :milestone_id, :state_event, :description + attr_accessible :title, :assignee_id, :source_project_id, :source_branch, + :target_project_id, :target_branch, :milestone_id, + :state_event, :description, :label_list attr_accessor :should_remove_source_branch @@ -44,6 +46,9 @@ class MergeRequest < ActiveRecord::Base # It allows us to close or modify broken merge requests attr_accessor :allow_broken + ActsAsTaggableOn.strict_case_match = true + acts_as_taggable_on :labels + state_machine :state, initial: :opened do event :close do transition [:reopened, :opened] => :closed diff --git a/app/models/project.rb b/app/models/project.rb index 7ddcc73cf2a..45e950f4807 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -281,8 +281,11 @@ class Project < ActiveRecord::Base self.id end + # Tags are shared by issues and merge requests def issues_labels - @issues_labels ||= (issues_default_labels + issues.tags_on(:labels)).uniq.sort_by(&:name) + @issues_labels ||= (issues_default_labels + + merge_requests.tags_on(:labels) + + issues.tags_on(:labels)).uniq.sort_by(&:name) end def issue_exists?(issue_id) diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml index 5e899d412c6..51a8c911af8 100644 --- a/app/views/projects/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -1,6 +1,7 @@ = render "head" .row .col-md-3 - = render 'shared/project_filter', project_entities_path: project_issues_path(@project), labels: true + = render 'shared/project_filter', project_entities_path: project_issues_path(@project), + labels: true, redirect: 'issues' .col-md-9.issues-holder = render "issues" diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml index 0fe2d1d9801..e385fba6afb 100644 --- a/app/views/projects/merge_requests/_form.html.haml +++ b/app/views/projects/merge_requests/_form.html.haml @@ -52,6 +52,15 @@ = f.text_area :description, class: "form-control js-gfm-input", rows: 14 %p.hint Description is parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}. + - if @merge_request.persisted? # Only allow labels on edit to avoid fork vs upstream repo labels issue + .form-group + = f.label :label_list, class: 'control-label' do + %i.icon-tag + Labels + .col-sm-10 + = f.text_field :label_list, maxlength: 2000, class: "form-control" + %p.hint Separate labels with commas. + .form-actions - if @merge_request.new_record? = f.submit 'Submit merge request', class: "btn btn-create" @@ -83,3 +92,32 @@ target_branch.on("change", function() { $.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() }); }); + + $("#merge_request_label_list") + .bind( "keydown", function( event ) { + if ( event.keyCode === $.ui.keyCode.TAB && + $( this ).data( "autocomplete" ).menu.active ) { + event.preventDefault(); + } + }) + .bind("click", function(event) { + $(this).autocomplete("search", ""); + }) + .autocomplete({ + minLength: 0, + source: function( request, response ) { + response( $.ui.autocomplete.filter( + #{raw labels_autocomplete_source}, extractLast( request.term ) ) ); + }, + focus: function() { + return false; + }, + select: function(event, ui) { + var terms = split( this.value ); + terms.pop(); + terms.push( ui.item.value ); + terms.push( "" ); + this.value = terms.join( ", " ); + return false; + } + }); diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index 980ac126742..25cf489b688 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -35,3 +35,9 @@ .pull-right %small updated #{time_ago_with_tooltip(merge_request.updated_at, 'bottom', 'merge_request_updated_ago')} + + .merge-request-labels + - merge_request.labels.each do |label| + %span{class: "label #{label_css_class(label.name)}"} + %i.icon-tag + = label.name diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml index e36a48f62cf..193c600f774 100644 --- a/app/views/projects/merge_requests/_show.html.haml +++ b/app/views/projects/merge_requests/_show.html.haml @@ -4,6 +4,7 @@ = render "projects/merge_requests/show/mr_box" = render "projects/merge_requests/show/state_widget" = render "projects/merge_requests/show/commits" + = render "projects/merge_requests/show/participants" - if @commits.present? %ul.nav.nav-tabs diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml index 34faebf619c..12a72edb224 100644 --- a/app/views/projects/merge_requests/index.html.haml +++ b/app/views/projects/merge_requests/index.html.haml @@ -8,7 +8,8 @@ %hr .row .col-md-3 - = render 'shared/project_filter', project_entities_path: project_merge_requests_path(@project) + = render 'shared/project_filter', project_entities_path: project_merge_requests_path(@project), + labels: true, redirect: 'merge_requests' .col-md-9 .mr-filters.append-bottom-10 .dropdown.inline diff --git a/app/views/projects/merge_requests/show/_participants.html.haml b/app/views/projects/merge_requests/show/_participants.html.haml new file mode 100644 index 00000000000..0dabd965e52 --- /dev/null +++ b/app/views/projects/merge_requests/show/_participants.html.haml @@ -0,0 +1,11 @@ +.participants + %cite.cgray #{@merge_request.participants.count} participants + - @merge_request.participants.each do |participant| + = link_to_member(@project, participant, name: false, size: 24) + + .merge-request-show-labels.pull-right + - @merge_request.labels.each do |label| + %span{class: "label #{label_css_class(label.name)}"} + %i.icon-tag + = label.name +   diff --git a/app/views/shared/_project_filter.html.haml b/app/views/shared/_project_filter.html.haml index d82b08eeaa2..7936a038be3 100644 --- a/app/views/shared/_project_filter.html.haml +++ b/app/views/shared/_project_filter.html.haml @@ -44,7 +44,7 @@ .light-well Add first label to your issues %br - or #{link_to 'generate', generate_project_labels_path(@project), method: :post} default set of labels + or #{link_to 'generate', generate_project_labels_path(@project, redirect: redirect), method: :post} default set of labels %fieldset - if %w(state scope milestone_id assignee_id label_name).select { |k| params[k].present? }.any? diff --git a/lib/api/entities.rb b/lib/api/entities.rb index abe6fceff14..1fd29acefe1 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -135,6 +135,7 @@ module API expose :target_branch, :source_branch, :upvotes, :downvotes expose :author, :assignee, using: Entities::UserBasic expose :source_project_id, :target_project_id + expose :label_list, as: :labels end class SSHKey < Grape::Entity diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 4b88b0f84c1..5fac2a3ea19 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -67,6 +67,7 @@ module API # assignee_id - Assignee user ID # title (required) - Title of MR # description - Description of MR + # labels (optional) - Labels for MR as a comma-separated list # # Example: # POST /projects/:id/merge_requests @@ -75,6 +76,7 @@ module API authorize! :write_merge_request, user_project required_attributes! [:source_branch, :target_branch, :title] attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description] + attrs[:label_list] = params[:labels] if params[:labels].present? merge_request = ::MergeRequests::CreateService.new(user_project, current_user, attrs).execute if merge_request.valid? @@ -95,11 +97,13 @@ module API # title - Title of MR # state_event - Status of MR. (close|reopen|merge) # description - Description of MR + # labels (optional) - Labels for a MR as a comma-separated list # Example: # PUT /projects/:id/merge_request/:merge_request_id # put ":id/merge_request/:merge_request_id" do attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event, :description] + attrs[:label_list] = params[:labels] if params[:labels].present? merge_request = user_project.merge_requests.find(params[:merge_request_id]) authorize! :modify_merge_request, merge_request merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, attrs).execute(merge_request) diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 4b8f41a4683..81e6abbb0d7 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -14,6 +14,12 @@ describe API::API, api: true do let(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) } let(:users_project2) { create(:users_project, user: user3, project: project, project_access: UsersProject::DEVELOPER) } let(:issue_with_labels) { create(:issue, author: user, assignee: user, project: project, :label_list => "label1, label2") } + let(:merge_request_with_labels) do + create(:merge_request, :simple, author: user, assignee: user, + source_project: project, target_project: project, title: 'Test', + label_list: 'label3, label4') + end + describe "GET /projects" do before { project } @@ -634,15 +640,45 @@ describe API::API, api: true do end end - describe "GET /projects/:id/labels" do - before { issue_with_labels } + describe 'GET /projects/:id/labels' do + context 'with an issue' do + before { issue_with_labels } - it "should return project labels" do - get api("/projects/#{project.id}/labels", user) - response.status.should == 200 - json_response.should be_an Array - json_response.first['name'].should == issue_with_labels.labels.first.name - json_response.last['name'].should == issue_with_labels.labels.last.name + it 'should return project labels' do + get api("/projects/#{project.id}/labels", user) + response.status.should == 200 + json_response.should be_an Array + json_response.first['name'].should == issue_with_labels.labels.first.name + json_response.last['name'].should == issue_with_labels.labels.last.name + end + end + + context 'with a merge request' do + before { merge_request_with_labels } + + it 'should return project labels' do + get api("/projects/#{project.id}/labels", user) + response.status.should == 200 + json_response.should be_an Array + json_response.first['name'].should == merge_request_with_labels.labels.first.name + json_response.last['name'].should == merge_request_with_labels.labels.last.name + end + end + + context 'with an issue and a merge request' do + before do + issue_with_labels + merge_request_with_labels + end + + it 'should return project labels from both' do + get api("/projects/#{project.id}/labels", user) + response.status.should == 200 + json_response.should be_an Array + all_labels = issue_with_labels.labels.map(&:name).to_a + .concat(merge_request_with_labels.labels.map(&:name).to_a) + json_response.map { |e| e['name'] }.should =~ all_labels + end end end end -- GitLab From 51280fc76c168e146bd29b05adecae19c2892fc0 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 15:15:46 +0300 Subject: [PATCH 164/237] Improve violet theme Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/sections/profile.scss | 2 +- app/assets/stylesheets/themes/ui_color.scss | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/sections/profile.scss b/app/assets/stylesheets/sections/profile.scss index 7a696c21e47..76483d6783b 100644 --- a/app/assets/stylesheets/sections/profile.scss +++ b/app/assets/stylesheets/sections/profile.scss @@ -84,7 +84,7 @@ } &.violet { - background: #547; + background: #548; } } } diff --git a/app/assets/stylesheets/themes/ui_color.scss b/app/assets/stylesheets/themes/ui_color.scss index edac4290e74..a08f3ff3d48 100644 --- a/app/assets/stylesheets/themes/ui_color.scss +++ b/app/assets/stylesheets/themes/ui_color.scss @@ -16,28 +16,28 @@ @extend .header-dark; &.navbar-gitlab { .navbar-inner { - background: #547; - border-bottom: 1px solid #435; + background: #548; + border-bottom: 1px solid #436; .app_logo, .navbar-toggle { &:hover { - background-color: #435; + background-color: #436; } } .separator { - background: #435; - border-left: 1px solid #658; + background: #436; + border-left: 1px solid #659; } .nav > li > a { - color: #98B; + color: #98C; } .search-input { - border-color: #98B; + border-color: #98C; } } } } .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { - background: #769; + background: #659; } } -- GitLab From 6b04a5f9108c640f638afa8055e2a5b60f926d5a Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 6 May 2014 19:51:56 +0200 Subject: [PATCH 165/237] Add support for Jira ticket mentions in format JIRA-123. Signed-off-by: Dmitriy Zaporozhets Conflicts: CHANGELOG-EE --- doc/integration/external-issue-tracker.md | 4 +- lib/gitlab/markdown.rb | 20 +++++++-- spec/helpers/gitlab_markdown_helper_spec.rb | 46 +++++++++++++++++++++ spec/lib/gitlab/reference_extractor_spec.rb | 6 +++ 4 files changed, 70 insertions(+), 6 deletions(-) diff --git a/doc/integration/external-issue-tracker.md b/doc/integration/external-issue-tracker.md index 7d8312075ac..e490b2f8846 100644 --- a/doc/integration/external-issue-tracker.md +++ b/doc/integration/external-issue-tracker.md @@ -2,8 +2,8 @@ GitLab has a great issue tracker but you can also use an external issue tracker - the 'Issues' link on the GitLab project pages takes you to the appropriate JIRA issue index; - clicking 'New issue' on the project dashboard creates a new JIRA issue; -- To reference JIRA issue PROJECT-1234 in comments, use syntax #PROJECT-1234. Commit messages get turned into HTML links to the corresponding JIRA issue. +- To reference JIRA issue PROJECT-1234 in comments, use syntax PROJECT-1234. Commit messages get turned into HTML links to the corresponding JIRA issue. ![jira screenshot](jira-integration-points.png) -You can configure the integration in the gitlab.yml configuration file. \ No newline at end of file +You can configure the integration in the gitlab.yml configuration file. diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index de14a3eca27..dca3d7a7bed 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -98,6 +98,7 @@ module Gitlab (?\W)? # Prefix ( # Reference @(?[a-zA-Z][a-zA-Z0-9_\-\.]*) # User name + |(?([A-Z\-]+-)\d+) # JIRA Issue ID |\#(?([a-zA-Z\-]+-)?\d+) # Issue ID |!(?\d+) # MR ID |\$(?\d+) # Snippet ID @@ -172,11 +173,15 @@ module Gitlab end def reference_issue(identifier) - if @project.issue_exists? identifier - url = url_for_issue(identifier) - title = title_for_issue(identifier) + if @project.used_default_issues_tracker? || !external_issues_tracker_enabled? + if @project.issue_exists? identifier + url = url_for_issue(identifier) + title = title_for_issue(identifier) - link_to("##{identifier}", url, html_options.merge(title: "Issue: #{title}", class: "gfm gfm-issue #{html_options[:class]}")) + link_to("##{identifier}", url, html_options.merge(title: "Issue: #{title}", class: "gfm gfm-issue #{html_options[:class]}")) + end + else + reference_jira_issue(identifier) if @project.issues_tracker == "jira" end end @@ -197,5 +202,12 @@ module Gitlab link_to(identifier, project_commit_url(@project, commit), html_options.merge(title: commit.link_title, class: "gfm gfm-commit #{html_options[:class]}")) end end + + def reference_jira_issue(identifier) + url = url_for_issue(identifier) + title = Gitlab.config.issues_tracker[@project.issues_tracker]["title"] + + link_to("#{identifier}", url, html_options.merge(title: "Issue in #{title}", class: "gfm gfm-issue #{html_options[:class]}")) + end end end diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 5bd16d1c16c..8c33ceeff26 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -181,6 +181,52 @@ describe GitlabMarkdownHelper do include_examples 'referenced object' end + describe "referencing a Jira issue" do + let(:actual) { "Reference to JIRA-#{issue.iid}" } + let(:expected) { "http://jira.example/browse/JIRA-#{issue.iid}" } + let(:reference) { "JIRA-#{issue.iid}" } + + before do + hash = { "jira" => { "title" => "JIRA tracker", "issues_url" => "http://jira.example/browse/:id" } } + Gitlab.config.stub(:issues_tracker).and_return(hash) + @project.stub(:issues_tracker).and_return("jira") + @project.stub(:issues_tracker_id).and_return("JIRA") + end + + it "should link using a valid id" do + gfm(actual).should match(expected) + end + + it "should link with adjacent text" do + # Wrap the reference in parenthesis + gfm(actual.gsub(reference, "(#{reference})")).should match(expected) + + # Append some text to the end of the reference + gfm(actual.gsub(reference, "#{reference}, right?")).should match(expected) + end + + it "should keep whitespace intact" do + actual = "Referenced #{reference} already." + expected = /Referenced [^\s]+<\/a> already/ + gfm(actual).should match(expected) + end + + it "should not link with an invalid id" do + # Modify the reference string so it's still parsed, but is invalid + invalid_reference = actual.gsub(/(\d+)$/, "r45") + gfm(invalid_reference).should == invalid_reference + end + + it "should include a title attribute" do + title = "Issue in JIRA tracker" + gfm(actual).should match(/title="#{title}"/) + end + + it "should include standard gfm classes" do + gfm(actual).should match(/class="\s?gfm gfm-issue\s?"/) + end + end + describe "referencing a merge request" do let(:object) { merge_request } let(:reference) { "!#{merge_request.iid}" } diff --git a/spec/lib/gitlab/reference_extractor_spec.rb b/spec/lib/gitlab/reference_extractor_spec.rb index 19259a8b79c..99fed27c796 100644 --- a/spec/lib/gitlab/reference_extractor_spec.rb +++ b/spec/lib/gitlab/reference_extractor_spec.rb @@ -11,6 +11,12 @@ describe Gitlab::ReferenceExtractor do subject.issues.should == ["1234"] end + it 'extracts JIRA issue references' do + Gitlab.config.gitlab.stub(:issues_tracker).and_return("jira") + subject.analyze "this one talks about issue JIRA-1234" + subject.issues.should == ["JIRA-1234"] + end + it 'extracts merge request references' do subject.analyze "and here's !43, a merge request" subject.merge_requests.should == ["43"] -- GitLab From bb89661365a3085302d7fbc0e66e991a421f73c6 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 7 May 2014 12:09:05 +0200 Subject: [PATCH 166/237] Better name for config variable. --- spec/helpers/gitlab_markdown_helper_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 8c33ceeff26..49b48d26e2b 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -187,8 +187,8 @@ describe GitlabMarkdownHelper do let(:reference) { "JIRA-#{issue.iid}" } before do - hash = { "jira" => { "title" => "JIRA tracker", "issues_url" => "http://jira.example/browse/:id" } } - Gitlab.config.stub(:issues_tracker).and_return(hash) + issue_tracker_config = { "jira" => { "title" => "JIRA tracker", "issues_url" => "http://jira.example/browse/:id" } } + Gitlab.config.stub(:issues_tracker).and_return(issue_tracker_config) @project.stub(:issues_tracker).and_return("jira") @project.stub(:issues_tracker_id).and_return("JIRA") end -- GitLab From caa876af90025f345d1d91466f80458b23ec0235 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 16:01:13 +0300 Subject: [PATCH 167/237] Improve file title Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/files.scss | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/generic/files.scss b/app/assets/stylesheets/generic/files.scss index 6418f24d97f..9e4207965f9 100644 --- a/app/assets/stylesheets/generic/files.scss +++ b/app/assets/stylesheets/generic/files.scss @@ -11,14 +11,11 @@ } .file-title { - background: #DDD; + background: #EEE; border-bottom: 1px solid #CCC; text-shadow: 0 1px 1px #fff; margin: 0; - font-weight: normal; - font-weight: bold; text-align: left; - color: $style_color; padding: 9px 10px; .options { @@ -31,12 +28,15 @@ } .file_name { - color: $style_color; + font-weight: bold; + padding-left: 3px; font-size: 14px; - text-shadow: 0 1px 1px #fff; + small { - color: #999; + color: #888; font-size: 13px; + font-weight: normal; + padding-left: 10px; } } } -- GitLab From b787540f71a3a7e68e940f39e7c903b0214a80e3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 16:40:08 +0300 Subject: [PATCH 168/237] Change diff header bg Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/sections/diff.scss | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/sections/diff.scss b/app/assets/stylesheets/sections/diff.scss index 64e669ac2b3..af44654d5da 100644 --- a/app/assets/stylesheets/sections/diff.scss +++ b/app/assets/stylesheets/sections/diff.scss @@ -4,7 +4,7 @@ .diff-header { @extend .clearfix; - background: #DDD; + background: #EEE; border-bottom: 1px solid #CCC; padding: 5px 5px 5px 10px; color: #555; @@ -77,7 +77,7 @@ margin: 0px; padding: 0px; border: none; - background: #EEE; + background: #F5F5F5; color: #666; padding: 0px 5px; border-right: 1px solid #ccc; @@ -295,15 +295,9 @@ } //.view.onion-skin } .view-modes{ - padding: 10px; text-align: center; - - background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf)); - background-image: -webkit-linear-gradient(#eee 6.6%, #dfdfdf); - background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf); - background-image: -ms-linear-gradient(#eee 6.6%, #dfdfdf); - background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf); + background: #EEE; ul, li{ list-style: none; -- GitLab From d41fba4d374c5b586a25b755d79a410574f09062 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 13 May 2014 17:08:59 +0200 Subject: [PATCH 169/237] Add warning to gitlab.yml related to gzip assets and relative links. --- config/gitlab.yml.example | 1 + 1 file changed, 1 insertion(+) diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 3774910cf96..b6ec80c4c08 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -31,6 +31,7 @@ production: &base # 2) In your gitlab.yml file: relative_url_root: /gitlab # 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" # 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab" + # 5) In lib/support/nginx/gitlab : do not use asset gzipping, remove block starting with "location ~ ^/(assets)/" # To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production # # relative_url_root: /gitlab -- GitLab From d57889212bf5481c50076e9980c27f5a6531ec6b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 18:41:36 +0300 Subject: [PATCH 170/237] Green theme instead of dark Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/sections/profile.scss | 2 +- app/assets/stylesheets/themes/ui_modern.scss | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/sections/profile.scss b/app/assets/stylesheets/sections/profile.scss index 76483d6783b..67aaa369381 100644 --- a/app/assets/stylesheets/sections/profile.scss +++ b/app/assets/stylesheets/sections/profile.scss @@ -76,7 +76,7 @@ } &.modern { - background: #345; + background: #009871; } &.gray { diff --git a/app/assets/stylesheets/themes/ui_modern.scss b/app/assets/stylesheets/themes/ui_modern.scss index b0827deb1ac..17981955db1 100644 --- a/app/assets/stylesheets/themes/ui_modern.scss +++ b/app/assets/stylesheets/themes/ui_modern.scss @@ -16,24 +16,29 @@ @extend .header-dark; &.navbar-gitlab { .navbar-inner { - background: #345; - border-bottom: 1px solid #234; + background: #00AC7E; + border-bottom: 1px solid #00AC7E; .app_logo, .navbar-toggle { &:hover { - background-color: #234; + background-color: #009C6E; } } .separator { - background: #234; - border-left: 1px solid #456; + background: #009C6F; + border-left: 1px solid #10BC8E; } .nav > li > a { - color: #89A; + color: #ADC; + text-shadow: none; } .search-input { - border-color: #89A; + border-color: #7fd5be; } } } } + + .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { + background: #00AC7E; + } } -- GitLab From 636ec6d3a048957b5cb348d7ff1b0b5bc6973bbf Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 13 May 2014 17:59:08 +0200 Subject: [PATCH 171/237] Update warnings about relative url support. --- config/application.rb | 5 ++++- config/gitlab.yml.example | 12 ++---------- config/unicorn.rb.example | 10 ++-------- lib/support/nginx/gitlab | 5 ++++- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/config/application.rb b/config/application.rb index 76b19eeb529..f087d3507bc 100644 --- a/config/application.rb +++ b/config/application.rb @@ -66,13 +66,16 @@ module Gitlab # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' + # Relative url support # Uncomment and customize the last line to run in a non-root path # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. - # Note that four settings need to be changed for this to work. + # Note that following settings need to be changed for this to work. # 1) In your application.rb file: config.relative_url_root = "/gitlab" # 2) In your gitlab.yml file: relative_url_root: /gitlab # 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" # 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab" + # 5) In lib/support/nginx/gitlab : do not use asset gzipping, remove block starting with "location ~ ^/(assets)/" + # # To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production # # config.relative_url_root = "/gitlab" diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index b6ec80c4c08..07c9681f9ad 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -24,16 +24,8 @@ production: &base # Otherwise, ssh host will be set to the `host:` value above # ssh_host: ssh.host_example.com - # Uncomment and customize the last line to run in a non-root path - # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. - # Note that four settings need to be changed for this to work. - # 1) In your application.rb file: config.relative_url_root = "/gitlab" - # 2) In your gitlab.yml file: relative_url_root: /gitlab - # 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" - # 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab" - # 5) In lib/support/nginx/gitlab : do not use asset gzipping, remove block starting with "location ~ ^/(assets)/" - # To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production - # + # WARNING: See config/application.rb under "Relative url support" for the list of + # other files that need to be changed for relative url support # relative_url_root: /gitlab # Uncomment and customize if you can't use the default user to run GitLab (default: 'git') diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example index ba5e5cdde0b..f6c0f09b51d 100644 --- a/config/unicorn.rb.example +++ b/config/unicorn.rb.example @@ -8,14 +8,8 @@ # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete # documentation. -# Uncomment and customize the last line to run in a non-root path -# WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. -# Note that four settings need to be changed for this to work. -# 1) In your application.rb file: config.relative_url_root = "/gitlab" -# 2) In your gitlab.yml file: relative_url_root: /gitlab -# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" -# 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab" -# To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production +# WARNING: See config/application.rb under "Relative url support" for the list of +# other files that need to be changed for relative url support # # ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" diff --git a/lib/support/nginx/gitlab b/lib/support/nginx/gitlab index f64c8d5883c..98c91637390 100644 --- a/lib/support/nginx/gitlab +++ b/lib/support/nginx/gitlab @@ -59,6 +59,9 @@ server { } # Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression + # WARNING: If you are using relative urls do remove the block below + # See config/application.rb under "Relative url support" for the list of + # other files that need to be changed for relative url support location ~ ^/(assets)/ { root /home/git/gitlab/public; gzip_static on; # to serve pre-gzipped version @@ -67,4 +70,4 @@ server { } error_page 502 /502.html; -} \ No newline at end of file +} -- GitLab From c91300e4ce1f991a6070330c6fe2f7528dea3e10 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 19:55:03 +0300 Subject: [PATCH 172/237] Remove text-shadow from header Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/main/mixins.scss | 1 - app/assets/stylesheets/sections/header.scss | 4 ---- app/assets/stylesheets/themes/ui_modern.scss | 1 - 3 files changed, 6 deletions(-) diff --git a/app/assets/stylesheets/main/mixins.scss b/app/assets/stylesheets/main/mixins.scss index 147c759ecb8..8143cfa2c81 100644 --- a/app/assets/stylesheets/main/mixins.scss +++ b/app/assets/stylesheets/main/mixins.scss @@ -52,7 +52,6 @@ @mixin header-font { color: $style_color; - text-shadow: 0 1px 1px #FFF; font-size: 16px; line-height: 44px; font-weight: normal; diff --git a/app/assets/stylesheets/sections/header.scss b/app/assets/stylesheets/sections/header.scss index 06709bd7ef6..1adbdfd9790 100644 --- a/app/assets/stylesheets/sections/header.scss +++ b/app/assets/stylesheets/sections/header.scss @@ -14,7 +14,6 @@ header { .nav > li > a { color: $style_color; - text-shadow: 0 1px 0 #fff; font-size: 14px; line-height: 32px; padding: 6px 10px; @@ -190,7 +189,6 @@ header { .nav > li > a { color: #AAA; - text-shadow: 0 1px 0 #444; &:hover, &:focus, &:active { background: none; @@ -224,7 +222,6 @@ header { background: image-url('logo-white.png') no-repeat center center; background-size: 32px; color: #fff; - text-shadow: 0 1px 1px #444; } } } @@ -236,7 +233,6 @@ header { } } color: #fff; - text-shadow: 0 1px 1px #444; } } diff --git a/app/assets/stylesheets/themes/ui_modern.scss b/app/assets/stylesheets/themes/ui_modern.scss index 17981955db1..67616a4a10d 100644 --- a/app/assets/stylesheets/themes/ui_modern.scss +++ b/app/assets/stylesheets/themes/ui_modern.scss @@ -29,7 +29,6 @@ } .nav > li > a { color: #ADC; - text-shadow: none; } .search-input { border-color: #7fd5be; -- GitLab From 24b68fdada1fbcc4874c32703aac0ca7ef1d52b4 Mon Sep 17 00:00:00 2001 From: Evgeniy Sokovikov Date: Wed, 14 May 2014 13:13:05 +0400 Subject: [PATCH 173/237] fix ctrl+enter note send use argument e instead of event --- app/assets/javascripts/notes.js.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index 47989010d1a..4510718c2fd 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -55,7 +55,7 @@ class Notes @notes_forms = '.js-main-target-form textarea, .js-discussion-note-form textarea' $(document).on('keypress', @notes_forms, (e)-> - if event.keyCode == 10 || (event.ctrlKey && event.keyCode == 13) + if e.keyCode == 10 || (e.ctrlKey && e.keyCode == 13) $(@).parents('form').submit() ) -- GitLab From ad7de951214fcfa9a0677b2b8bd669b5bd07d83e Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 13:48:51 +0200 Subject: [PATCH 174/237] Add an example webhook receiver --- doc/web_hooks/web_hooks.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index 5ad0c8a138f..a223d83da3f 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -112,3 +112,34 @@ Triggered when a new merge request is created or an existing merge request was u } } ``` + +#### Example webhook receiver + +If you want to see GitLab's webhooks in action for testing purposes you can use +a simple echo script running in a console session. + +Save the following file as `print_http_body.rb`. + +```ruby +require 'webrick' + +server = WEBrick::HTTPServer.new(Port: ARGV.first) +server.mount_proc '/' do |req, res| + puts req.body +end + +trap 'INT' do server.shutdown end +server.start +``` + +Pick an unused port (e.g. 8000) and start the script: `ruby print_http_body.rb +8000`. Then add your server as a webhook receiver in GitLab as +`http://my.host:8000/`. + +When you press 'Test Hook' in GitLab, you should see something like this in the console. + +``` +{"before":"077a85dd266e6f3573ef7e9ef8ce3343ad659c4e","after":"95cd4a99e93bc4bbabacfa2cd10e6725b1403c60",} +localhost - - [14/May/2014:07:45:26 EDT] "POST / HTTP/1.1" 200 0 +- -> / +``` -- GitLab From fda0dff6d3bb20c6d05dee67d969354ae95244ea Mon Sep 17 00:00:00 2001 From: dosire Date: Wed, 14 May 2014 14:49:14 +0200 Subject: [PATCH 175/237] Add pullreview badge. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ca7bec3b6d6..efac636c24e 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ * [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) +* [![PullReview stats](https://www.pullreview.com/gitlab/gitlab-org/gitlab-ce/badges/master.svg?)](https://www.pullreview.com/gitlab.gitlab.com/gitlab-org/gitlab-ce/reviews/master) + ### Resources * [GitLab.com](https://www.gitlab.com/) includes information about [subscriptions](https://www.gitlab.com/subscription/), [consultancy](https://www.gitlab.com/consultancy/), the [community](https://www.gitlab.com/community/) and the [hosted GitLab Cloud](https://www.gitlab.com/cloud/). -- GitLab From c4c2655c010b1095bb9c28337041d21cf3271dca Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 14 May 2014 15:02:42 +0200 Subject: [PATCH 176/237] Bump grit version. --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c022868bc2e..f5f31105e18 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -162,7 +162,7 @@ GEM multi_json gitlab-grack (2.0.0.pre) rack (~> 1.5.1) - gitlab-grit (2.6.6) + gitlab-grit (2.6.7) charlock_holmes (~> 0.6) diff-lcs (~> 1.1) mime-types (~> 1.15) -- GitLab From 2f8fd80ebba35706d70fd7b4d4246d7cc1b65ac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E7=BA=AB?= Date: Wed, 14 May 2014 22:06:52 +0800 Subject: [PATCH 177/237] Correct a wrong spelling "abolute" -> "absolute" --- doc/install/requirements.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/install/requirements.md b/doc/install/requirements.md index dc21a7e55ab..fd2dd16cd8e 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -53,7 +53,7 @@ We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/)) but GitLab ## Memory -- 512MB is the abolute minimum, you need 256MB of swap, you can configure only one slow unicorn worker, only ssh access will work, we do not recommend this +- 512MB is the absolute minimum, you need 256MB of swap, you can configure only one slow unicorn worker, only ssh access will work, we do not recommend this - 1GB supports up to 100 users (with individual repositories under 250MB, otherwise git memory usage necessitates using swap space) - **2GB** is the **recommended** memory size and supports up to 500 users - 4GB supports up to 2,000 users @@ -84,4 +84,4 @@ If you want to run the database separately, the **recommended** database size is - Firefox (Latest released version) - Safari 7+ (known problem: required fields in html5 do not work) - Opera (Latest released version) -- IE 10+ \ No newline at end of file +- IE 10+ -- GitLab From f4bca105d16e3bc47c2cd2725c519d2dcd788e70 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:10:43 +0200 Subject: [PATCH 178/237] Backport Adapter#ldap_search from EE --- lib/gitlab/ldap/adapter.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/ldap/adapter.rb b/lib/gitlab/ldap/adapter.rb index 0777558d643..7bdcb4b9743 100644 --- a/lib/gitlab/ldap/adapter.rb +++ b/lib/gitlab/ldap/adapter.rb @@ -64,7 +64,7 @@ module Gitlab end end - entries = ldap.search(options).select do |entry| + entries = ldap_search(options).select do |entry| entry.respond_to? config.uid end @@ -77,6 +77,22 @@ module Gitlab users(*args).first end + def ldap_search(*args) + results = ldap.search(*args) + + if results.nil? + response = ldap.get_operation_result + + unless response.code.zero? + Rails.logger.warn("LDAP search error: #{response.message}") + end + + [] + else + results + end + end + private def config -- GitLab From 982d4d51e8110bec280eb00db0fb756b062103d9 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:11:14 +0200 Subject: [PATCH 179/237] Backport Adapter#dn_matches_filter? from EE --- lib/gitlab/ldap/adapter.rb | 4 +++ spec/lib/gitlab/ldap/ldap_adapter_spec.rb | 31 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 spec/lib/gitlab/ldap/ldap_adapter_spec.rb diff --git a/lib/gitlab/ldap/adapter.rb b/lib/gitlab/ldap/adapter.rb index 7bdcb4b9743..e36616f0e66 100644 --- a/lib/gitlab/ldap/adapter.rb +++ b/lib/gitlab/ldap/adapter.rb @@ -77,6 +77,10 @@ module Gitlab users(*args).first end + def dn_matches_filter?(dn, filter) + ldap_search(base: dn, filter: filter, scope: Net::LDAP::SearchScope_BaseObject, attributes: %w{dn}).any? + end + def ldap_search(*args) results = ldap.search(*args) diff --git a/spec/lib/gitlab/ldap/ldap_adapter_spec.rb b/spec/lib/gitlab/ldap/ldap_adapter_spec.rb new file mode 100644 index 00000000000..c3f07334431 --- /dev/null +++ b/spec/lib/gitlab/ldap/ldap_adapter_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe Gitlab::LDAP::Adapter do + let(:adapter) { Gitlab::LDAP::Adapter.new } + + describe :dn_matches_filter? do + let(:ldap) { double(:ldap) } + subject { adapter.dn_matches_filter?(:dn, :filter) } + before { adapter.stub(ldap: ldap) } + + context "when the search is successful" do + context "and the result is non-empty" do + before { ldap.stub(search: [:foo]) } + + it { should be_true } + end + + context "and the result is empty" do + before { ldap.stub(search: []) } + + it { should be_false } + end + end + + context "when the search encounters an error" do + before { ldap.stub(search: nil, get_operation_result: double(code: 1, message: 'some error')) } + + it { should be_false } + end + end +end -- GitLab From d54133b09fdb0b2e589896dc8740bb8d0c99ed54 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:14:06 +0200 Subject: [PATCH 180/237] Add spec for LDAP::Access#allowed? --- spec/lib/gitlab/ldap/ldap_access_spec.rb | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 spec/lib/gitlab/ldap/ldap_access_spec.rb diff --git a/spec/lib/gitlab/ldap/ldap_access_spec.rb b/spec/lib/gitlab/ldap/ldap_access_spec.rb new file mode 100644 index 00000000000..e76cc4f2fde --- /dev/null +++ b/spec/lib/gitlab/ldap/ldap_access_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe Gitlab::LDAP::Access do + let(:access) { Gitlab::LDAP::Access.new } + let(:user) { create(:user) } + + describe :allowed? do + subject { access.allowed?(user) } + + context 'when the user cannot be found' do + before { Gitlab::LDAP::Person.stub(find_by_dn: nil) } + + it { should be_false } + end + + context 'when the user is found' do + before { Gitlab::LDAP::Person.stub(find_by_dn: :ldap_user) } + + context 'and the Active Directory disabled flag is set' do + before { Gitlab::LDAP::Person.stub(ad_disabled?: true) } + + it { should be_false } + end + + context 'and the Active Directory disabled flag is not set' do + before { Gitlab::LDAP::Person.stub(ad_disabled?: false) } + + it { should be_true } + end + end + end +end -- GitLab From a754f0b2205d4f09092c8c7c032ad944a229be8f Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:26:58 +0200 Subject: [PATCH 181/237] Add LDAP::Person#ad_disabled? Check the bit for disabled Active Directory users. The filter is based on http://ctogonewild.com/2009/09/03/bitmask-searches-in-ldap/ . --- lib/gitlab/ldap/person.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb index 06b17c58f8c..fa57f298e16 100644 --- a/lib/gitlab/ldap/person.rb +++ b/lib/gitlab/ldap/person.rb @@ -1,6 +1,8 @@ module Gitlab module LDAP class Person + AD_USER_DISABLED = Net::LDAP::Filter.ex("userAccountControl:1.2.840.113556.1.4.803", 2) + def self.find_by_uid(uid, adapter=nil) adapter ||= Gitlab::LDAP::Adapter.new adapter.user(config.uid, uid) @@ -11,6 +13,11 @@ module Gitlab adapter.user('dn', dn) end + def self.ad_disabled?(dn, adapter=nil) + adapter ||= Gitlab::LDAP::Adapter.new + adapter.dn_matches_filter?(dn, AD_USER_DISABLED) + end + def initialize(entry) Rails.logger.debug { "Instantiating #{self.class.name} with LDIF:\n#{entry.to_ldif}" } @entry = entry -- GitLab From a6e4153878eda841b0a71e5e1666e6bed0a050ae Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:32:40 +0200 Subject: [PATCH 182/237] Check for the AD disabled flag in Access#allowed? --- lib/gitlab/ldap/access.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/ldap/access.rb b/lib/gitlab/ldap/access.rb index 8f492e5c012..71931b79f62 100644 --- a/lib/gitlab/ldap/access.rb +++ b/lib/gitlab/ldap/access.rb @@ -14,7 +14,11 @@ module Gitlab end def allowed?(user) - !!Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter) + if Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter) + !Gitlab::LDAP::Person.ad_disabled?(user.extern_uid, adapter) + else + false + end rescue false end -- GitLab From 11dba4cee7dc43f88c340bccd553cff0e3d874e4 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:54:05 +0200 Subject: [PATCH 183/237] Fix syntax error in AD disabled user filter --- lib/gitlab/ldap/person.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb index fa57f298e16..17ffde0e84f 100644 --- a/lib/gitlab/ldap/person.rb +++ b/lib/gitlab/ldap/person.rb @@ -1,7 +1,7 @@ module Gitlab module LDAP class Person - AD_USER_DISABLED = Net::LDAP::Filter.ex("userAccountControl:1.2.840.113556.1.4.803", 2) + AD_USER_DISABLED = Net::LDAP::Filter.ex("userAccountControl:1.2.840.113556.1.4.803", "2") def self.find_by_uid(uid, adapter=nil) adapter ||= Gitlab::LDAP::Adapter.new -- GitLab From 797e807249076920d6c4bb71f6258ca05ee0db34 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 19:04:00 +0200 Subject: [PATCH 184/237] Use LDAP::Access.open to reuse the LDAP connection --- lib/gitlab/git_access.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index eefdb1833fc..f3e781ac4e9 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -66,8 +66,8 @@ module Gitlab if Gitlab.config.ldap.enabled if user.ldap_user? # Check if LDAP user exists and match LDAP user_filter - unless Gitlab::LDAP::Access.new.allowed?(user) - return false + Gitlab::LDAP::Access.open do |adapter| + return false unless adapter.allowed?(user) end end end -- GitLab From a966f72224427fe6830426f459d445cd19ecd5a0 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 19:08:42 +0200 Subject: [PATCH 185/237] Document the Active Directory magic numbers --- lib/gitlab/ldap/person.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb index 17ffde0e84f..3a97944b122 100644 --- a/lib/gitlab/ldap/person.rb +++ b/lib/gitlab/ldap/person.rb @@ -1,6 +1,9 @@ module Gitlab module LDAP class Person + # Active Directory-specific LDAP filter that checks if bit 2 of the + # userAccountControl attribute is set. + # Source: http://ctogonewild.com/2009/09/03/bitmask-searches-in-ldap/ AD_USER_DISABLED = Net::LDAP::Filter.ex("userAccountControl:1.2.840.113556.1.4.803", "2") def self.find_by_uid(uid, adapter=nil) -- GitLab From be1120e9681bfb83084c7aeadae3e83692901de9 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 19:13:06 +0200 Subject: [PATCH 186/237] Improve ad_disabled method name --- lib/gitlab/ldap/access.rb | 2 +- lib/gitlab/ldap/person.rb | 2 +- spec/lib/gitlab/ldap/ldap_access_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gitlab/ldap/access.rb b/lib/gitlab/ldap/access.rb index 71931b79f62..4e48ff11871 100644 --- a/lib/gitlab/ldap/access.rb +++ b/lib/gitlab/ldap/access.rb @@ -15,7 +15,7 @@ module Gitlab def allowed?(user) if Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter) - !Gitlab::LDAP::Person.ad_disabled?(user.extern_uid, adapter) + !Gitlab::LDAP::Person.active_directory_disabled?(user.extern_uid, adapter) else false end diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb index 3a97944b122..9ad6618bd46 100644 --- a/lib/gitlab/ldap/person.rb +++ b/lib/gitlab/ldap/person.rb @@ -16,7 +16,7 @@ module Gitlab adapter.user('dn', dn) end - def self.ad_disabled?(dn, adapter=nil) + def self.active_directory_disabled?(dn, adapter=nil) adapter ||= Gitlab::LDAP::Adapter.new adapter.dn_matches_filter?(dn, AD_USER_DISABLED) end diff --git a/spec/lib/gitlab/ldap/ldap_access_spec.rb b/spec/lib/gitlab/ldap/ldap_access_spec.rb index e76cc4f2fde..d8c107502ba 100644 --- a/spec/lib/gitlab/ldap/ldap_access_spec.rb +++ b/spec/lib/gitlab/ldap/ldap_access_spec.rb @@ -17,13 +17,13 @@ describe Gitlab::LDAP::Access do before { Gitlab::LDAP::Person.stub(find_by_dn: :ldap_user) } context 'and the Active Directory disabled flag is set' do - before { Gitlab::LDAP::Person.stub(ad_disabled?: true) } + before { Gitlab::LDAP::Person.stub(active_directory_disabled?: true) } it { should be_false } end context 'and the Active Directory disabled flag is not set' do - before { Gitlab::LDAP::Person.stub(ad_disabled?: false) } + before { Gitlab::LDAP::Person.stub(active_directory_disabled?: false) } it { should be_true } end -- GitLab From b024c094d3b6a2d1f81e0314dbfcfb1e6303155d Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 08:01:00 +0200 Subject: [PATCH 187/237] Add CHANGELOG entry for the AD disabled flag --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index be5da8bebfa..1559a9969bf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,7 @@ v 6.9.0 - Two Step MR creation process - Remove unwanted files from satellite working directory with git clean -fdx - Accept merge request via API (sponsored by O'Reilly Media) + - Block SSH access for 'disabled' Active Directory users v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion -- GitLab From 6d45909f03f6cc32f72135ce7ca7b4fd62132c15 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 09:57:21 +0200 Subject: [PATCH 188/237] Add test for current behavior of current_user --- spec/requests/api/api_helpers_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/requests/api/api_helpers_spec.rb b/spec/requests/api/api_helpers_spec.rb index 6f961d321bd..2dcbce09b27 100644 --- a/spec/requests/api/api_helpers_spec.rb +++ b/spec/requests/api/api_helpers_spec.rb @@ -39,6 +39,11 @@ describe API, api: true do end describe ".current_user" do + it "should return nil for an invalid token" do + env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = 'invalid token' + current_user.should be_nil + end + it "should leave user as is when sudo not specified" do env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = user.private_token current_user.should == user -- GitLab From 34fd557055e027b6423241e73b7cf26c741c0b6b Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 10:17:13 +0200 Subject: [PATCH 189/237] Move user access check to Gitlab::UserAccess --- lib/gitlab/git_access.rb | 13 +------------ lib/gitlab/user_access.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 lib/gitlab/user_access.rb diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index f3e781ac4e9..4f49ca4189e 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -61,18 +61,7 @@ module Gitlab private def user_allowed?(user) - return false if user.blocked? - - if Gitlab.config.ldap.enabled - if user.ldap_user? - # Check if LDAP user exists and match LDAP user_filter - Gitlab::LDAP::Access.open do |adapter| - return false unless adapter.allowed?(user) - end - end - end - - true + Gitlab::UserAccess.allowed?(user) end end end diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb new file mode 100644 index 00000000000..16df21b49ba --- /dev/null +++ b/lib/gitlab/user_access.rb @@ -0,0 +1,18 @@ +module Gitlab + module UserAccess + def self.allowed?(user) + return false if user.blocked? + + if Gitlab.config.ldap.enabled + if user.ldap_user? + # Check if LDAP user exists and match LDAP user_filter + Gitlab::LDAP::Access.open do |adapter| + return false unless adapter.allowed?(user) + end + end + end + + true + end + end +end -- GitLab From 02b85fd2366bc6c0d3194ab68e13eb6291733c26 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 10:03:26 +0200 Subject: [PATCH 190/237] Check user access status in API for current_user --- lib/api/helpers.rb | 5 +++++ spec/requests/api/api_helpers_spec.rb | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 7ee4b9d1381..654c1f62c6c 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -8,6 +8,11 @@ module API def current_user private_token = (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]).to_s @current_user ||= User.find_by(authentication_token: private_token) + + unless @current_user && Gitlab::UserAccess.allowed?(@current_user) + return nil + end + identifier = sudo_identifier() # If the sudo is the current user do nothing diff --git a/spec/requests/api/api_helpers_spec.rb b/spec/requests/api/api_helpers_spec.rb index 2dcbce09b27..a4869476574 100644 --- a/spec/requests/api/api_helpers_spec.rb +++ b/spec/requests/api/api_helpers_spec.rb @@ -44,6 +44,11 @@ describe API, api: true do current_user.should be_nil end + it "should return nil for a user without access" do + Gitlab::UserAccess.stub(allowed?: false) + current_user.should be_nil + end + it "should leave user as is when sudo not specified" do env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = user.private_token current_user.should == user -- GitLab From 2d8c310f11f6340e043da97dfc10f268a78c2d9e Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 10:30:50 +0200 Subject: [PATCH 191/237] Make user access test pass for the right reason If we do not set a private token during the test, current_user will be nil because the user is not found, not due to the access check. --- spec/requests/api/api_helpers_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/requests/api/api_helpers_spec.rb b/spec/requests/api/api_helpers_spec.rb index a4869476574..e2f222c0d34 100644 --- a/spec/requests/api/api_helpers_spec.rb +++ b/spec/requests/api/api_helpers_spec.rb @@ -45,6 +45,7 @@ describe API, api: true do end it "should return nil for a user without access" do + env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = user.private_token Gitlab::UserAccess.stub(allowed?: false) current_user.should be_nil end -- GitLab From 223a8695be207aa1725d9ae3755e4d0396dfe9f0 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 10:32:20 +0200 Subject: [PATCH 192/237] Add API access checks to CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index be5da8bebfa..b1a7c3effb1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,7 @@ v 6.9.0 - Two Step MR creation process - Remove unwanted files from satellite working directory with git clean -fdx - Accept merge request via API (sponsored by O'Reilly Media) + - Add more access checks during API calls v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion -- GitLab From 0505a882991da981b4797e0a48c7c5098cd084e2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 15 May 2014 16:30:21 +0300 Subject: [PATCH 193/237] Hide control elements and last login for xs display Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/blob/_blob.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/projects/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml index e59d970bf46..863e4e3de53 100644 --- a/app/views/projects/blob/_blob.html.haml +++ b/app/views/projects/blob/_blob.html.haml @@ -15,18 +15,18 @@ - else = link_to title, '#' -%ul.blob-commit-info.bs-callout.bs-callout-info +%ul.blob-commit-info.bs-callout.bs-callout-info.hidden-xs - blob_commit = @repository.last_commit_for_path(@commit.id, @blob.path) = render blob_commit, project: @project %div#tree-content-holder.tree-content-holder .file-holder - .file-title + .file-title.clearfix %i.icon-file %span.file_name = blob.name %small= number_to_human_size blob.size - %span.options= render "actions" + %span.options.hidden-xs= render "actions" - if blob.text? = render "text", blob: blob - elsif blob.image? -- GitLab From a3a512f2efe293aa2a6a1e4eb7edf04fd9087974 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 15 May 2014 16:30:50 +0300 Subject: [PATCH 194/237] Hide group dashboard and project sidebar for xs size Signed-off-by: Dmitriy Zaporozhets --- app/views/groups/show.html.haml | 2 +- app/views/projects/show.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 0343670c203..0c62772a5c9 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -1,5 +1,5 @@ .dashboard - .activities.col-md-8.hidden-sm + .activities.col-md-8.hidden-sm.hidden-xs - if current_user = render "events/event_last_push", event: @last_push = link_to dashboard_path, class: 'btn btn-tiny' do diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 20879d69091..7e9f1122aa9 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -6,7 +6,7 @@ = render 'shared/event_filter' .content_list = spinner - .col-md-3.project-side.hidden-sm + .col-md-3.project-side.hidden-sm.hidden-xs .clearfix - if @project.archived? .alert.alert-warning -- GitLab From 474ae8a6877744108e256e5aacfffb815ce56583 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 16 May 2014 10:04:10 +0200 Subject: [PATCH 195/237] Remove logrotate step (no change in 6.8) --- doc/update/6.7-to-6.8.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/update/6.7-to-6.8.md b/doc/update/6.7-to-6.8.md index 457433c6482..cb19d235819 100644 --- a/doc/update/6.7-to-6.8.md +++ b/doc/update/6.7-to-6.8.md @@ -64,9 +64,6 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab -# Update the logrotate configuration (keep logs for 90 days instead of 52 weeks) -sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab - # Close access to gitlab-satellites for others sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites ``` -- GitLab From 00a482511c20dc427b10629e8a1c993472dae2b6 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 16 May 2014 10:10:31 +0200 Subject: [PATCH 196/237] Clean up *.log.1 files during 6.6-to-6.7 upgrade --- doc/update/6.6-to-6.7.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/update/6.6-to-6.7.md b/doc/update/6.6-to-6.7.md index 0f39c037c9f..61a63057d08 100644 --- a/doc/update/6.6-to-6.7.md +++ b/doc/update/6.6-to-6.7.md @@ -64,6 +64,10 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab # Update the logrotate configuration (keep logs for 90 days instead of 52 weeks) sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab +# Compress existing .log.1 files because we turned off delaycompress in logrotate +sudo -u git -H gzip /home/git/gitlab/log/*.log.1 +sudo -u git -H gzip /home/git/gitlab-shell/gitlab-shell.log.1 + # Close access to gitlab-satellites for others sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites ``` -- GitLab From 85cecc0b2ef25ef4e4dc56583b0e202400168abb Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 16 May 2014 13:28:35 +0300 Subject: [PATCH 197/237] Fix 500 error on group members search Signed-off-by: Dmitriy Zaporozhets --- app/controllers/groups_controller.rb | 2 +- features/group.feature | 7 +++++++ features/steps/group/group.rb | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index a3019b3ac78..ddaae6f0e8c 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -68,7 +68,7 @@ class GroupsController < ApplicationController @members = group.users_groups if params[:search].present? - users = group.users.search(params[:search]) + users = group.users.search(params[:search]).to_a @members = @members.where(user_id: users) end diff --git a/features/group.feature b/features/group.feature index 4e11bcba939..71c28c07a3c 100644 --- a/features/group.feature +++ b/features/group.feature @@ -113,3 +113,10 @@ Feature: Groups Then I should see user "John Doe" in team list Then I should see user "Mary Jane" in team list Then I should not see the "Remove User From Group" button for "Mary Jane" + + Scenario: Search member by name + Given "Mary Jane" is guest of group "Guest" + And I visit group "Guest" members page + When I search for 'Mary' member + Then I should see user "Mary Jane" in team list + Then I should not see user "John Doe" in team list diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb index 81472d1ca35..820d0ef2a1f 100644 --- a/features/steps/group/group.rb +++ b/features/steps/group/group.rb @@ -157,6 +157,13 @@ class Groups < Spinach::FeatureSteps # poltergeist always confirms popups. end + step 'I search for \'Mary\' member' do + within '.member-search-form' do + fill_in 'search', with: 'Mary' + click_button 'Search' + end + end + protected def assigned_to_me key -- GitLab From 52bd8d40667f6755828fdcc486dafbf34eb88627 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 16 May 2014 13:47:34 +0300 Subject: [PATCH 198/237] Improve issue box colors. Move colors to variables for future reuse Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/generic/issue_box.scss | 30 +++++++++---------- app/assets/stylesheets/main/variables.scss | 25 ++++++++++++++++ 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/app/assets/stylesheets/generic/issue_box.scss b/app/assets/stylesheets/generic/issue_box.scss index d4d3361bc72..bd692417989 100644 --- a/app/assets/stylesheets/generic/issue_box.scss +++ b/app/assets/stylesheets/generic/issue_box.scss @@ -15,39 +15,39 @@ @include box-shadow(0 1px 1px rgba(0, 0, 0, 0.05)); &.issue-box-closed { - border-color: #DA4E49; + border-color: $border_danger; .state { - background-color: #f2dede; - border-color: #ebccd1; - color: #a94442; + background-color: $bg_light_danger; + border-color: $border_danger; + color: $color_danger; .state-label { - background: #DA4E49; + background-color: $bg_danger; color: #FFF; } } } &.issue-box-merged { - border-color: #31708f; + border-color: $border_primary; .state { - background-color: #d9edf7; - border-color: #bce8f1; - color: #31708f; + background-color: $bg_light_primary; + border-color: $border_primary; + color: $color_primary; .state-label { - background: #31708f; + background-color: $bg_primary; color: #FFF; } } } &.issue-box-open { - border-color: #4A4; + border-color: $border_success; .state { - background-color: #dff0d8; - border-color: #d6e9c6; - color: #3c763d; + background-color: $bg_light_success; + border-color: $border_success; + color: $color_success; .state-label { - background: #4A4; + background-color: $bg_success; color: #FFF; } } diff --git a/app/assets/stylesheets/main/variables.scss b/app/assets/stylesheets/main/variables.scss index 4b5fa0979be..f133777de56 100644 --- a/app/assets/stylesheets/main/variables.scss +++ b/app/assets/stylesheets/main/variables.scss @@ -8,6 +8,31 @@ $bg_style_color: #2299BB; $list-group-active-bg: $bg_style_color; $hover: #D9EDF7; +/* + * Success colors (green) + */ +$border_success: #4cae4c; +$bg_success: #5cb85c; +$bg_light_success: #dff0d8; +$color_success: #3c763d; + +/* + * Danger colors (red) + */ +$border_danger: #d43f3a; +$bg_danger: #d9534f; +$bg_light_danger: #f2dede; +$color_danger: #a94442; + +/* + * Primary colors (blue) + */ +$border_primary: #358ebd; +$bg_primary: #429bca; +$bg_light_primary: #d9edf7; +$color_primary: #31708f; + + /** * Commit Diff Colors */ -- GitLab From dbd88d453b8e6c78a423fa7e692004b1db6ea069 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 16 May 2014 12:57:32 +0200 Subject: [PATCH 199/237] Update the examples to example.com --- config/gitlab.yml.example | 4 ++-- doc/install/installation.md | 2 +- doc/raketasks/maintenance.md | 6 +++--- doc/web_hooks/web_hooks.md | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 07c9681f9ad..7b53a065533 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -33,10 +33,10 @@ production: &base ## Email settings # Email address used in the "From" field in mails sent by GitLab - email_from: gitlab@localhost + email_from: example@example.com # Email address of your support contact (default: same as email_from) - support_email: support@localhost + support_email: support@example.com ## User settings default_projects_limit: 10 diff --git a/doc/install/installation.md b/doc/install/installation.md index eea5c763fcd..a2615b5d52d 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -201,7 +201,7 @@ You can change `6-8-stable` to `master` if you want the *bleeding edge* version, # Configure Git global settings for git user, useful when editing via web # Edit user.email according to what is set in gitlab.yml sudo -u git -H git config --global user.name "GitLab" - sudo -u git -H git config --global user.email "gitlab@localhost" + sudo -u git -H git config --global user.email "example@example.com" sudo -u git -H git config --global core.autocrlf input **Important Note:** diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md index 2783c4153c5..907c9352c59 100644 --- a/doc/raketasks/maintenance.md +++ b/doc/raketasks/maintenance.md @@ -24,9 +24,9 @@ Version: 5.1.0.beta2 Revision: 4da8b37 Directory: /home/git/gitlab DB Adapter: mysql2 -URL: http://localhost -HTTP Clone URL: http://localhost/some-project.git -SSH Clone URL: git@localhost:some-project.git +URL: http://example.com +HTTP Clone URL: http://example.com/some-project.git +SSH Clone URL: git@example.com:some-project.git Using LDAP: no Using Omniauth: no diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md index a223d83da3f..4c06bc4d444 100644 --- a/doc/web_hooks/web_hooks.md +++ b/doc/web_hooks/web_hooks.md @@ -25,16 +25,16 @@ Triggered when you push to the repository except when pushing tags. "project_id": 15, "repository": { "name": "Diaspora", - "url": "git@localhost:diaspora.git", + "url": "git@example.com:diaspora.git", "description": "", - "homepage": "http://localhost/diaspora" + "homepage": "http://example.com/diaspora" }, "commits": [ { "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "message": "Update Catalan translation to e38cb41.", "timestamp": "2011-12-12T14:27:31+02:00", - "url": "http://localhost/diaspora/commits/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", + "url": "http://example.com/diaspora/commits/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "author": { "name": "Jordi Mallach", "email": "jordi@softcatala.org" @@ -44,7 +44,7 @@ Triggered when you push to the repository except when pushing tags. "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "message": "fixed readme", "timestamp": "2012-01-03T23:36:29+02:00", - "url": "http://localhost/diaspora/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", + "url": "http://example.com/diaspora/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "author": { "name": "GitLab dev user", "email": "gitlabdev@dv6700.(none)" @@ -140,6 +140,6 @@ When you press 'Test Hook' in GitLab, you should see something like this in the ``` {"before":"077a85dd266e6f3573ef7e9ef8ce3343ad659c4e","after":"95cd4a99e93bc4bbabacfa2cd10e6725b1403c60",} -localhost - - [14/May/2014:07:45:26 EDT] "POST / HTTP/1.1" 200 0 +example.com - - [14/May/2014:07:45:26 EDT] "POST / HTTP/1.1" 200 0 - -> / ``` -- GitLab From d7cee6ed76b1892f4fe71d6f0cf6e83e8870478a Mon Sep 17 00:00:00 2001 From: Scooletz Date: Sat, 17 May 2014 00:04:09 +0200 Subject: [PATCH 200/237] .NET client introduced to docs --- doc/api/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/README.md b/doc/api/README.md index 4c40589fd4f..acd2f524beb 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -26,6 +26,7 @@ + [python-gitlab](https://github.com/Itxaka/python-gitlab) - Python + [java-gitlab-api](https://github.com/timols/java-gitlab-api) - Java + [node-gitlab](https://github.com/moul/node-gitlab) - Node.js ++ [NGitLab](https://github.com/Scooletz/NGitLab) - .NET ## Introduction -- GitLab From e1e9c307a6a5f0c3125fdb769ef065c55587782c Mon Sep 17 00:00:00 2001 From: dosire Date: Sat, 17 May 2014 10:41:12 +0200 Subject: [PATCH 201/237] Inform about the EE features. --- doc/integration/README.md | 2 ++ doc/integration/external-issue-tracker.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/doc/integration/README.md b/doc/integration/README.md index 8318113ce92..4773dd8fffb 100644 --- a/doc/integration/README.md +++ b/doc/integration/README.md @@ -7,3 +7,5 @@ See the documentation below for details on how to configure these services. + [LDAP](ldap.md) Set up sign in via LDAP + [OmniAuth](omniauth.md) Sign in via Twitter, GitHub, and Google via OAuth. + [Slack](slack.md) Integrate with the Slack chat service + +Jenkins support is [available in GitLab EE](http://doc.gitlab.com/ee/integration/jenkins.html). diff --git a/doc/integration/external-issue-tracker.md b/doc/integration/external-issue-tracker.md index e490b2f8846..1b531aeeda7 100644 --- a/doc/integration/external-issue-tracker.md +++ b/doc/integration/external-issue-tracker.md @@ -7,3 +7,5 @@ GitLab has a great issue tracker but you can also use an external issue tracker ![jira screenshot](jira-integration-points.png) You can configure the integration in the gitlab.yml configuration file. + +Support to add your commits to the Jira ticket automatically is [available in GitLab EE](http://doc.gitlab.com/ee/integration/jira.html). -- GitLab From 39d95b1d94968bd1fd465bde2790457e74addd06 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 19 May 2014 12:17:00 +0200 Subject: [PATCH 202/237] Update installation guide, create update guide. --- doc/install/installation.md | 16 +++---- doc/update/6.8-to-6.9.md | 96 +++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 8 deletions(-) create mode 100644 doc/update/6.8-to-6.9.md diff --git a/doc/install/installation.md b/doc/install/installation.md index a2615b5d52d..0df92913085 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -86,7 +86,7 @@ Is the system packaged Git too old? Remove it and compile from source. mail server. By default, Debian is shipped with exim4 whereas Ubuntu does not ship with one. The recommended mail server is postfix and you can install it with: - sudo apt-get install -y postfix + sudo apt-get install -y postfix Then select 'Internet Site' and press enter to confirm the hostname. @@ -150,13 +150,13 @@ NOTE: because we need to make use of extensions you need at least pgsql 9.1. ## Clone the Source # Clone GitLab repository - sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-8-stable gitlab + sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-9-stable gitlab # Go to gitlab dir cd /home/git/gitlab **Note:** -You can change `6-8-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! +You can change `6-9-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server! ## Configure it @@ -261,7 +261,7 @@ GitLab Shell is an ssh access and repository management software developed speci cd /home/git/gitlab # Run the installation task for gitlab-shell (replace `REDIS_URL` if needed): - sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.3] REDIS_URL=redis://localhost:6379 RAILS_ENV=production + sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.4] REDIS_URL=redis://localhost:6379 RAILS_ENV=production # By default, the gitlab-shell config is generated from your main gitlab config. You can review (and modify) it as follows: sudo -u git -H editor /home/git/gitlab-shell/config.yml @@ -409,22 +409,22 @@ GitLab uses [Omniauth](http://www.omniauth.org/) for authentication and already These steps are fairly general and you will need to figure out the exact details from the Omniauth provider's documentation. * Stop GitLab - `sudo service gitlab stop` + `sudo service gitlab stop` * Add provider specific configuration options to your `config/gitlab.yml` (you can use the [auth providers section of the example config](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example) as a reference) * Add the gem to your [Gemfile](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/Gemfile) `gem "omniauth-your-auth-provider"` * If you're using MySQL, install the new Omniauth provider gem by running the following command: - `sudo -u git -H bundle install --without development test postgres --path vendor/bundle --no-deployment` + `sudo -u git -H bundle install --without development test postgres --path vendor/bundle --no-deployment` * If you're using PostgreSQL, install the new Omniauth provider gem by running the following command: - `sudo -u git -H bundle install --without development test mysql --path vendor/bundle --no-deployment` + `sudo -u git -H bundle install --without development test mysql --path vendor/bundle --no-deployment` > These are the same commands you used in the [Install Gems section](#install-gems) with `--path vendor/bundle --no-deployment` instead of `--deployment`. * Start GitLab - `sudo service gitlab start` + `sudo service gitlab start` ### Examples diff --git a/doc/update/6.8-to-6.9.md b/doc/update/6.8-to-6.9.md new file mode 100644 index 00000000000..a5e644b8a07 --- /dev/null +++ b/doc/update/6.8-to-6.9.md @@ -0,0 +1,96 @@ +# From 6.8 to 6.9 + +### 0. Backup + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production +``` + +### 1. Stop server + +```bash +sudo service gitlab stop +``` + +### 2. Get latest code + +```bash +cd /home/git/gitlab +sudo -u git -H git fetch --all +``` + +For Gitlab Community Edition: + +```bash +sudo -u git -H git checkout 6-9-stable +``` + +OR + +For GitLab Enterprise Edition: + +```bash +sudo -u git -H git checkout 6-9-stable-ee +``` + +### 3. Update gitlab-shell (and its config) + +```bash +cd /home/git/gitlab-shell +sudo -u git -H git fetch +sudo -u git -H git checkout v1.9.4 +``` + +### 4. Install libs, migrations, etc. + +```bash +cd /home/git/gitlab + +# MySQL installations (note: the line below states '--without ... postgres') +sudo -u git -H bundle install --without development test postgres --deployment + +# PostgreSQL installations (note: the line below states '--without ... mysql') +sudo -u git -H bundle install --without development test mysql --deployment +``` + +### 5. Update config files + +#### New configuration options for gitlab.yml + +There are new configuration options available for gitlab.yml. View them with the command below and apply them to your current gitlab.yml if desired. + +``` +git diff 6-8-stable:config/gitlab.yml.example 6-9-stable:config/gitlab.yml.example +``` + +### 6. Start application + + sudo service gitlab start + sudo service nginx restart + +### 7. Check application status + +Check if GitLab and its environment are configured correctly: + + sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production + +To make sure you didn't miss anything run a more thorough check with: + + sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production + +If all items are green, then congratulations upgrade is complete! + +## Things went south? Revert to previous version (6.8) + +### 1. Revert the code to the previous version +Follow the [`upgrade guide from 6.7 to 6.8`](6.7-to-6.8.md), except for the database migration +(The backup is already migrated to the previous version) + +### 2. Restore from the backup: + +```bash +cd /home/git/gitlab +sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production +``` +If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above. -- GitLab From aacd43d72dcb6d36834a055df52c283a6ce2ffa7 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 19 May 2014 12:31:20 +0200 Subject: [PATCH 203/237] 6.9.0 RC1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c0ad52beda3..fed1b9285ff 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.9.0.pre +6.9.0.rc1 -- GitLab From 85c5a20352c7e739859eae8ad972f08fc61592b0 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 19 May 2014 13:34:26 +0300 Subject: [PATCH 204/237] Small UI change to milestone page so it looks similar to issue/mr Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/milestones/show.html.haml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml index 5c5df46d33d..0fe5ac25b5e 100644 --- a/app/views/projects/milestones/show.html.haml +++ b/app/views/projects/milestones/show.html.haml @@ -1,8 +1,6 @@ = render "projects/issues/head" %h3.page-title Milestone ##{@milestone.iid} - %small - = @milestone.expires_at .pull-right - if can?(current_user, :admin_milestone, @project) = link_to edit_project_milestone_path(@project, @milestone), class: "btn btn-grouped" do @@ -23,14 +21,16 @@ .issue-box{ class: issue_box_class(@milestone) } - .state - %span.state-label + .state.clearfix + .state-label.col-sm-2.col-xs-12 - if @milestone.closed? Closed - elsif @milestone.expired? Expired - else Open + %span.creator.col-sm-9.col-xs-12 + = @milestone.expires_at %h4.title = gfm escape_once(@milestone.title) -- GitLab From 0202c98772f0fa760a346edef34db91671d05e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20K=C3=A4llberg?= Date: Mon, 19 May 2014 12:45:52 +0100 Subject: [PATCH 205/237] Added Cloud 66 to third party one-click installers --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index efac636c24e..e06d0162e29 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,8 @@ * [BitNami one-click installers](http://bitnami.com/stack/gitlab) This package contains both GitLab and GitLab CI. It is available as installer, virtual machine or for cloud hosting providers (Amazon Web Services/Azure/etc.). +* [Cloud 66 deployment and management](http://blog.cloud66.com/installing-gitlab-ubuntu/) Use Cloud 66 to deploy GitLab to your own server or any cloud (eg. DigitalOcean, AWS, Rackspace, GCE) and then manage it with database backups, scaling and more! + #### Unofficial installation methods * [GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/) repository with unofficial guides for using GitLab with different software (operating systems, webservers, etc.) than the official version. -- GitLab From 50313b646d41b423d6a424b8c1d4e173dc66e76b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20K=C3=A4llberg?= Date: Mon, 19 May 2014 12:55:56 +0100 Subject: [PATCH 206/237] Removed exclamation mark for Cloud 66 installer --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e06d0162e29..a745d120f6e 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ * [BitNami one-click installers](http://bitnami.com/stack/gitlab) This package contains both GitLab and GitLab CI. It is available as installer, virtual machine or for cloud hosting providers (Amazon Web Services/Azure/etc.). -* [Cloud 66 deployment and management](http://blog.cloud66.com/installing-gitlab-ubuntu/) Use Cloud 66 to deploy GitLab to your own server or any cloud (eg. DigitalOcean, AWS, Rackspace, GCE) and then manage it with database backups, scaling and more! +* [Cloud 66 deployment and management](http://blog.cloud66.com/installing-gitlab-ubuntu/) Use Cloud 66 to deploy GitLab to your own server or any cloud (eg. DigitalOcean, AWS, Rackspace, GCE) and then manage it with database backups, scaling and more. #### Unofficial installation methods -- GitLab From 126eefc5b84272e15ecdd856a97234de6ca10d0c Mon Sep 17 00:00:00 2001 From: dosire Date: Mon, 19 May 2014 14:45:55 +0200 Subject: [PATCH 207/237] Ruby version updated so it doesn't have the readline bug https://www.ruby-lang.org/en/news/2014/05/09/ruby-2-0-0-p481-is-released/. --- doc/install/installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index 0df92913085..4fbba3ca4b3 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -101,8 +101,8 @@ Remove the old Ruby 1.8 if present Download Ruby and compile it: mkdir /tmp/ruby && cd /tmp/ruby - curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz - cd ruby-2.0.0-p353 + curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz | tar xz + cd ruby-2.0.0-p481 ./configure --disable-install-rdoc make sudo make install -- GitLab From dca537ab2902aa9936e4c29574ad540793028a76 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 19 May 2014 17:49:29 +0200 Subject: [PATCH 208/237] Use the gitlabhq fork of the MySQL converter --- doc/update/mysql_to_postgresql.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index 5b9209d7df4..4d591d4d4cf 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -15,7 +15,7 @@ sudo service gitlab stop # Update /home/git/gitlab/config/database.yml -git clone https://github.com/lanyrd/mysql-postgresql-converter.git +git clone https://github.com/gitlabhq/mysql-postgresql-converter.git cd mysql-postgresql-converter mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production python db_converter.py databasename.mysql databasename.psql -- GitLab From 6be0188b5c289b1cff7f15fcfdff0ea9b8eec1ff Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 19 May 2014 17:51:58 +0200 Subject: [PATCH 209/237] Rebuild indexes after a MySQL conversion --- doc/update/mysql_to_postgresql.md | 38 +++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index 4d591d4d4cf..acd1e33f599 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -1,10 +1,11 @@ # Migrating GitLab from MySQL to Postgres If you are replacing MySQL with Postgres while keeping GitLab on the same -server all you need to do is to export from MySQL and import into Postgres as -described below. If you are also moving GitLab to another server, or if you are -switching to omnibus-gitlab, you may want to use a GitLab backup file. The -second part of this documents explains the procedure to do this. +server all you need to do is to export from MySQL, import into Postgres and +rebuild the indexes as described below. If you are also moving GitLab to +another server, or if you are switching to omnibus-gitlab, you may want to use +a GitLab backup file. The second part of this documents explains the procedure +to do this. ## Export from MySQL and import into Postgres @@ -21,9 +22,35 @@ mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.m python db_converter.py databasename.mysql databasename.psql psql -f databasename.psql -d gitlabhq_production +# Rebuild indexes (see below) + sudo service gitlab start ``` + +## Rebuild indexes + +The lanyrd database converter script does not preserve all indexes, so we have +to recreate them ourselves after migrating from MySQL. It is not necessary to +shut down GitLab for this process. + +``` +# Clone the database converter on your Postgres-backed GitLab server +cd /tmp +git clone https://github.com/gitlabhq/mysql-postgresql-converter.git + +# Stash changes to db/schema.rb to make sure we can find the right index statements +cd /home/git/gitlab +sudo -u git -H git stash + +# Generate the `CREATE INDEX CONCURRENTLY` statements based on schema.rb +cd /tmp/mysql-to-postgresql-converter +ruby index_create_statements.rb /home/git/gitlab/db/schema.rb > index_create_statements.psql + +# Execute the SQL statements against the GitLab database +sudo -u git psql -f index_create_statements.psql -d gitlabhq_production +``` + ## Converting a GitLab backup file from MySQL to Postgres GitLab backup files (_gitlab_backup.tar) contain a SQL dump. Using @@ -64,5 +91,6 @@ sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_produc sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql -# Done! TIMESTAMP_gitlab_backup.tar can now be restored into a Postgres GitLab installation. +# Done! TIMESTAMP_gitlab_backup.tar can now be restored into a Postgres GitLab +# installation. Remember to recreate the indexes after the import. ``` -- GitLab From ea109704d10d7fc5e9808e5355df994a7f6e109b Mon Sep 17 00:00:00 2001 From: Job van der Voort Date: Mon, 19 May 2014 20:35:59 +0200 Subject: [PATCH 210/237] everything in header --- doc/api/deploy_key_multiple_projects.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/deploy_key_multiple_projects.md b/doc/api/deploy_key_multiple_projects.md index f4121a718e6..1a5a458905e 100644 --- a/doc/api/deploy_key_multiple_projects.md +++ b/doc/api/deploy_key_multiple_projects.md @@ -5,15 +5,16 @@ If you want to easily add the same deploy key to multiple projects in the same g First, find the ID of the projects you're interested in, by either listing all projects: ``` -curl https://gitlab.com/api/v3/projects?private_token=abcdef +curl --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/projects ``` Or finding the id of a group and then listing all projects in that group: ``` -curl https://gitlab.com/api/v3/groups?private_token=abcdef +curl --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/groups -curl https://gitlab.com/api/v3/groups/1234?private_token=abcdef # where the id of the group is 1234 +# For group 1234: +curl --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/groups/1234 ``` With those IDs, add the same deploy key to all: -- GitLab From 5d770882028ab98556b0d27716affc9f1b54dd55 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 20 May 2014 12:00:23 +0300 Subject: [PATCH 211/237] Do gitlab:shell setup before seeds because we need /home/git/repositories exists Signed-off-by: Dmitriy Zaporozhets --- doc/install/installation.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index 4fbba3ca4b3..44f5a28fde5 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -244,15 +244,6 @@ that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. # Or if you use MySQL (note, the option says "without ... postgres") sudo -u git -H bundle install --deployment --without development test postgres aws - -## Initialize Database and Activate Advanced Features - - sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production - - # Type 'yes' to create the database tables. - - # When done you see 'Administrator account created:' - ## Install GitLab shell GitLab Shell is an ssh access and repository management software developed specially for GitLab. @@ -266,6 +257,15 @@ GitLab Shell is an ssh access and repository management software developed speci # By default, the gitlab-shell config is generated from your main gitlab config. You can review (and modify) it as follows: sudo -u git -H editor /home/git/gitlab-shell/config.yml + +## Initialize Database and Activate Advanced Features + + sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production + + # Type 'yes' to create the database tables. + + # When done you see 'Administrator account created:' + ## Install Init Script Download the init script (will be /etc/init.d/gitlab): -- GitLab From ce8e7d280b06a0dde196743f2fea29750f8089b1 Mon Sep 17 00:00:00 2001 From: dosire Date: Tue, 20 May 2014 14:30:25 +0200 Subject: [PATCH 212/237] Change cloud into .com --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index efac636c24e..9e0f81a93e7 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ ### Canonical source -* The source of GitLab Communinity Edition is [hosted on GitLab Cloud](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible. +* The source of GitLab Communinity Edition is [hosted on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible. ### Code status -- GitLab From 9eb7fe6d06f39cc011fa9ee3cc8b137d60f5d90e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 20 May 2014 16:21:30 +0300 Subject: [PATCH 213/237] Fix admin user errors ui Signed-off-by: Dmitriy Zaporozhets --- app/views/admin/users/_form.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml index 881a043f36f..b9e6382ea88 100644 --- a/app/views/admin/users/_form.html.haml +++ b/app/views/admin/users/_form.html.haml @@ -2,9 +2,9 @@ = form_for [:admin, @user], html: { class: 'form-horizontal' } do |f| -if @user.errors.any? #error_explanation - %ul.unstyled.alert.alert-danger + .alert.alert-danger - @user.errors.full_messages.each do |msg| - %li= msg + %p= msg %fieldset %legend Account -- GitLab From c18e2778b2f1a4a2c3fb8e0f79c400456645e036 Mon Sep 17 00:00:00 2001 From: Olaf Mandel Date: Tue, 20 May 2014 15:22:23 +0200 Subject: [PATCH 214/237] Fix avatar URLs in JS-lists for relative_url_root In user lists created when entering a (partial) user name into a field, the URL to the user avatar was invalid if running with relative_url_root. This patch is the result of: sed -i 's/\(= *\)\(user\.avatar_url\)/\1gon.relative_url_root + \2/' \ app/assets/javascripts/*.coffee --- app/assets/javascripts/project_users_select.js.coffee | 2 +- app/assets/javascripts/users_select.js.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/project_users_select.js.coffee b/app/assets/javascripts/project_users_select.js.coffee index b0e39610feb..a7fec960406 100644 --- a/app/assets/javascripts/project_users_select.js.coffee +++ b/app/assets/javascripts/project_users_select.js.coffee @@ -37,7 +37,7 @@ projectUserFormatResult: (user) -> if user.avatar_url - avatar = user.avatar_url + avatar = gon.relative_url_root + user.avatar_url else if gon.gravatar_enabled avatar = gon.gravatar_url avatar = avatar.replace('%{hash}', md5(user.email)) diff --git a/app/assets/javascripts/users_select.js.coffee b/app/assets/javascripts/users_select.js.coffee index ce9a505b1e3..cab9f6271eb 100644 --- a/app/assets/javascripts/users_select.js.coffee +++ b/app/assets/javascripts/users_select.js.coffee @@ -1,7 +1,7 @@ $ -> userFormatResult = (user) -> if user.avatar_url - avatar = user.avatar_url + avatar = gon.relative_url_root + user.avatar_url else if gon.gravatar_enabled avatar = gon.gravatar_url avatar = avatar.replace('%{hash}', md5(user.email)) -- GitLab From 1a4c9118aec5c25bf39cdc6db640569bf5c6d0e9 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 20 May 2014 16:22:47 +0300 Subject: [PATCH 215/237] Fix UI for wiki error message Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/wikis/_form.html.haml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/projects/wikis/_form.html.haml b/app/views/projects/wikis/_form.html.haml index c77ed3433d1..0c2e33f2282 100644 --- a/app/views/projects/wikis/_form.html.haml +++ b/app/views/projects/wikis/_form.html.haml @@ -1,10 +1,9 @@ = form_for [@project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal' } do |f| -if @page.errors.any? #error_explanation - %h2= "#{pluralize(@page.errors.count, "error")} prohibited this wiki from being saved:" - %ul + .alert.alert-danger - @page.errors.full_messages.each do |msg| - %li= msg + %p= msg = f.hidden_field :title, value: @page.title .form-group -- GitLab From ac46130748c31f3052f7ac325f897637e7b326f5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 20 May 2014 16:36:51 +0300 Subject: [PATCH 216/237] Allow set group avatar when create group. Not only edit page Signed-off-by: Dmitriy Zaporozhets --- app/views/groups/new.html.haml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml index 955a107e542..ebf5e8571aa 100644 --- a/app/views/groups/new.html.haml +++ b/app/views/groups/new.html.haml @@ -13,6 +13,17 @@ .col-sm-10 = f.text_area :description, maxlength: 250, class: "form-control js-gfm-input", rows: 4 + .form-group.group-description-holder + = f.label :avatar, "Group avatar", class: 'control-label' + .col-sm-10 + %a.choose-btn.btn.btn-small.js-choose-group-avatar-button + %i.icon-paper-clip + %span Choose File ... +   + %span.file_name.js-avatar-filename File name... + = f.file_field :avatar, class: "js-group-avatar-input hidden" + .light The maximum file size allowed is 100KB. + .form-group .col-sm-2 .col-sm-10 -- GitLab From 13761caead142c38c5163a3ae5d9bc650c186d71 Mon Sep 17 00:00:00 2001 From: dosire Date: Tue, 20 May 2014 20:51:35 +0200 Subject: [PATCH 217/237] Fixed spelling mistake in readme with a whole room watching. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e0f81a93e7..4c423fb207e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ ### Canonical source -* The source of GitLab Communinity Edition is [hosted on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible. +* The source of GitLab Community Edition is [hosted on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible. ### Code status -- GitLab From b08fe47fe8977905252c73653cece86359922e29 Mon Sep 17 00:00:00 2001 From: Alan Kehoe Date: Tue, 20 May 2014 22:03:34 +0100 Subject: [PATCH 218/237] Update message on the group dashboard page --- app/views/groups/show.html.haml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/groups/show.html.haml b/app/views/groups/show.html.haml index 0c62772a5c9..17475288a87 100644 --- a/app/views/groups/show.html.haml +++ b/app/views/groups/show.html.haml @@ -5,7 +5,10 @@ = link_to dashboard_path, class: 'btn btn-tiny' do ← To dashboard   - %span.cgray You will only see events from projects in this group + %span.cgray + Currently you are only seeing events from the + = @group.name + group %hr = render 'shared/event_filter' - if @events.any? -- GitLab From 60053e6e2c79e47c84f1703a35e5c073249b9086 Mon Sep 17 00:00:00 2001 From: dosire Date: Wed, 21 May 2014 13:06:12 +0200 Subject: [PATCH 219/237] It now is a metal dev install. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2bd9d8e84f..cbbfebc81ef 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ * [GitLab packages](https://www.gitlab.com/downloads/) **recommended** These packages contain GitLab and all its depencies (Ruby, PostgreSQL, Redis, Nginx, Unicorn, etc.). They are made with [omnibus-gitlab](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md) that also contains the installation instructions. -* [GitLab Chef Cookbook](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/README.md) This cookbook can be used both for development installations and production installations. If you want to [contribute](CONTRIBUTE.md) to GitLab we suggest you follow the [development installation on a virtual machine with Vagrant](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/doc/development.md) instructions to install all testing dependencies. +* [GitLab Chef Cookbook](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/README.md) This cookbook can be used both for development installations and production installations. If you want to [contribute](CONTRIBUTE.md) to GitLab we suggest you follow the [development installation](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/doc/development.md) instructions to install all testing dependencies. * [Manual installation guide](doc/install/installation.md) This guide to set up a production server on Ubuntu offers detailed and complete step-by-step instructions. -- GitLab From d1980adf93e417850fcd3bac8caed1f2c9da7fb4 Mon Sep 17 00:00:00 2001 From: Marc Radulescu Date: Thu, 22 May 2014 10:35:01 +0200 Subject: [PATCH 220/237] typos fixed --- app/views/groups/_projects.html.haml | 2 +- app/views/groups/edit.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/groups/_projects.html.haml b/app/views/groups/_projects.html.haml index bd4e3156af0..41f8cb9da40 100644 --- a/app/views/groups/_projects.html.haml +++ b/app/views/groups/_projects.html.haml @@ -8,7 +8,7 @@ New project %ul.well-list - if projects.blank? - .nothing-here-block This groups has no projects yet + .nothing-here-block This group has no projects yet - projects.each do |project| %li.project-row = link_to project_path(project), class: dom_class(project) do diff --git a/app/views/groups/edit.html.haml b/app/views/groups/edit.html.haml index 500c37ab71d..2a5614cff6c 100644 --- a/app/views/groups/edit.html.haml +++ b/app/views/groups/edit.html.haml @@ -45,7 +45,7 @@ - if @group.avatar? You can change your group avatar here - else - You can upload an group avatar here + You can upload a group avatar here %a.choose-btn.btn.btn-small.js-choose-group-avatar-button %i.icon-paper-clip %span Choose File ... -- GitLab From b019c06195cf3ca3e097f57c53cbd863165fa077 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 22 May 2014 11:01:01 +0200 Subject: [PATCH 221/237] Required shell version is now 1.9.4. --- lib/tasks/gitlab/check.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index bf015a1fe16..0387795fa48 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -779,7 +779,7 @@ namespace :gitlab do end def check_gitlab_shell - required_version = Gitlab::VersionInfo.new(1, 9, 3) + required_version = Gitlab::VersionInfo.new(1, 9, 4) current_version = Gitlab::VersionInfo.parse(gitlab_shell_version) print "GitLab Shell version >= #{required_version} ? ... " -- GitLab From 38d0e001eac2026b8526fc7098bd147df4fc522d Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 22 May 2014 11:09:00 +0200 Subject: [PATCH 222/237] Version to 6.9.0 --- CHANGELOG | 1 + VERSION | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 2f7874ba724..aaf1879dcce 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,7 @@ v 6.9.0 - Accept merge request via API (sponsored by O'Reilly Media) - Add more access checks during API calls - Block SSH access for 'disabled' Active Directory users + - Labels for merge requests (Drew Blessing) v 6.8.0 - Ability to at mention users that are participating in issue and merge req. discussion diff --git a/VERSION b/VERSION index fed1b9285ff..97f57815281 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.9.0.rc1 +6.9.0 -- GitLab From 1ad174fbcdb7c14eb8fbe9820e1152383f41a89e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 12:25:44 +0300 Subject: [PATCH 223/237] Improve edit page UI/UX Signed-off-by: Dmitriy Zaporozhets --- app/assets/stylesheets/sections/diff.scss | 5 ++++ .../projects/edit_tree/preview.html.haml | 2 +- app/views/projects/edit_tree/show.html.haml | 23 +++++++++++-------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/sections/diff.scss b/app/assets/stylesheets/sections/diff.scss index af44654d5da..24d997c9fca 100644 --- a/app/assets/stylesheets/sections/diff.scss +++ b/app/assets/stylesheets/sections/diff.scss @@ -330,3 +330,8 @@ } } } + +.file-content .diff-file { + margin: 0; + border: none; +} diff --git a/app/views/projects/edit_tree/preview.html.haml b/app/views/projects/edit_tree/preview.html.haml index fc6d3bfbc24..340f68cc05c 100644 --- a/app/views/projects/edit_tree/preview.html.haml +++ b/app/views/projects/edit_tree/preview.html.haml @@ -23,4 +23,4 @@ %td.new_line= link_to raw(type == "old" ? " " : line_new) , "##{line_code}", id: line_code %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line) - else - %p.nothing_here_message No changes. + .nothing-here-block No changes. diff --git a/app/views/projects/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml index 93037ef9585..32a6d4ef36e 100644 --- a/app/views/projects/edit_tree/show.html.haml +++ b/app/views/projects/edit_tree/show.html.haml @@ -1,23 +1,26 @@ -%h3.page-title Edit mode .file-editor + %ul.nav.nav-tabs.js-edit-mode + %li.active + = link_to 'Edit', '#editor' + %li + = link_to editing_preview_title(@blob.name), '#preview', 'data-preview-url' => preview_project_edit_tree_path(@project, @id) + = form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do .file-holder.file .file-title - .btn-group.js-edit-mode.left-options - = link_to 'Edit', '#editor', class: 'active hover btn btn-tiny' - = link_to editing_preview_title(@blob.name), '#preview', class: 'btn btn-tiny', 'data-preview-url' => preview_project_edit_tree_path(@project, @id) %i.icon-file %span.file_name + %span.monospace.light #{@ref}: = @path - %small - on - %strong= @ref %span.options .btn-group.tree-btn-group = link_to "Cancel", @after_edit_path, class: "btn btn-tiny btn-cancel", data: { confirm: leave_edit_message } .file-content.code %pre.js-edit-mode-pane#editor= @blob.data .js-edit-mode-pane#preview.hide + %center + %h2 + %i.icon-spinner.icon-spin .form-group.commit_message-group = label_tag 'commit_message', class: "control-label" do @@ -61,14 +64,14 @@ paneId = currentLink.attr('href'), currentPane = editModePanes.filter(paneId); - editModeLinks.removeClass('active hover'); - currentLink.addClass('active hover'); + editModeLinks.parent().removeClass('active hover'); + currentLink.parent().addClass('active hover'); editModePanes.hide(); if (paneId == '#preview') { + currentPane.fadeIn(200); $.post(currentLink.data('preview-url'), { content: editor.getValue() }, function(response) { currentPane.empty().append(response); - currentPane.fadeIn(200); }) } else { currentPane.fadeIn(200); -- GitLab From 88781783dd425d1ba4ff5cacf9b4cc4c23a9a35e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 14:23:20 +0300 Subject: [PATCH 224/237] Delete branch service with permission checks Signed-off-by: Dmitriy Zaporozhets --- app/services/delete_branch_service.rb | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 app/services/delete_branch_service.rb diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb new file mode 100644 index 00000000000..9f48ab4b60d --- /dev/null +++ b/app/services/delete_branch_service.rb @@ -0,0 +1,42 @@ +class DeleteBranchService + def execute(project, branch_name, current_user) + repository = project.repository + branch = repository.find_branch(branch_name) + + # No such branch + unless branch + return error('No such branch') + end + + # Dont allow remove of protected branch + if project.protected_branch?(branch_name) + return error('Protected branch cant be removed') + end + + # Dont allow user to remove branch if he is not allowed to push + unless current_user.can?(:push_code, project) + return error('You dont have push access to repo') + end + + if repository.rm_branch(branch_name) + Event.create_ref_event(project, current_user, branch, 'rm') + success('Branch was removed') + else + return error('Failed to remove branch') + end + end + + def error(message) + { + message: message, + state: :error + } + end + + def success(message) + { + message: message, + state: :success + } + end +end -- GitLab From e089b11b7a4026acc7706e519682f4b7141b2bcd Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 14:38:48 +0300 Subject: [PATCH 225/237] Add BranchesHelper Signed-off-by: Dmitriy Zaporozhets --- app/helpers/branches_helper.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/helpers/branches_helper.rb diff --git a/app/helpers/branches_helper.rb b/app/helpers/branches_helper.rb new file mode 100644 index 00000000000..e08ffccb94c --- /dev/null +++ b/app/helpers/branches_helper.rb @@ -0,0 +1,11 @@ +module BranchesHelper + def can_remove_branch?(project, branch_name) + if project.protected_branch? branch_name + false + elsif branch_name == project.repository.root_ref + false + else + can?(current_user, :push_code, project) + end + end +end -- GitLab From 0455391add2032dddc7353d1b0ae36d591818d3f Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 14:39:09 +0300 Subject: [PATCH 226/237] Improve branch-removal logic Signed-off-by: Dmitriy Zaporozhets --- app/controllers/projects/branches_controller.rb | 9 ++------- app/services/delete_branch_service.rb | 4 ++++ app/views/projects/branches/_branch.html.haml | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index 6a6cbe48184..00811f17adb 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -4,8 +4,7 @@ class Projects::BranchesController < Projects::ApplicationController before_filter :require_non_empty_project before_filter :authorize_code_access! - before_filter :authorize_push!, only: [:create] - before_filter :authorize_admin_project!, only: [:destroy] + before_filter :authorize_push!, only: [:create, :destroy] def index @branches = Kaminari.paginate_array(@repository.branches).page(params[:page]).per(30) @@ -22,11 +21,7 @@ class Projects::BranchesController < Projects::ApplicationController end def destroy - branch = @repository.find_branch(params[:id]) - - if branch && @repository.rm_branch(branch.name) - Event.create_ref_event(@project, current_user, branch, 'rm') - end + DeleteBranchService.new.execute(project, params[:id], current_user) respond_to do |format| format.html { redirect_to project_branches_path(@project) } diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb index 9f48ab4b60d..ce2d8093dff 100644 --- a/app/services/delete_branch_service.rb +++ b/app/services/delete_branch_service.rb @@ -8,6 +8,10 @@ class DeleteBranchService return error('No such branch') end + if branch_name == repository.root_ref + return error('Cannot remove HEAD branch') + end + # Dont allow remove of protected branch if project.protected_branch?(branch_name) return error('Protected branch cant be removed') diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index f0731977098..87f4dd88c27 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -16,8 +16,8 @@ %i.icon-copy Compare - - if can?(current_user, :admin_project, @project) && branch.name != @repository.root_ref - = link_to project_branch_path(@project, branch.name), class: 'btn btn-grouped btn-small remove-row', method: :delete, data: { confirm: 'Removed branch cannot be restored. Are you sure?'}, remote: true do + - if can_remove_branch?(@project, branch.name) + = link_to project_branch_path(@project, branch.name), class: 'btn btn-grouped btn-small btn-remove remove-row', method: :delete, data: { confirm: 'Removed branch cannot be restored. Are you sure?'}, remote: true do %i.icon-trash - if commit -- GitLab From a9d60b3b146acf5540b422919fa87fa931801062 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 14:39:50 +0300 Subject: [PATCH 227/237] Api call to remove branch Signed-off-by: Dmitriy Zaporozhets --- lib/api/branches.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/api/branches.rb b/lib/api/branches.rb index d54f9371fbe..32597eb94c4 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -84,6 +84,18 @@ module API present @branch, with: Entities::RepoObject, project: user_project end + + # Delete branch + # + # Parameters: + # id (required) - The ID of a project + # branch (required) - The name of the branch + # Example Request: + # DELETE /projects/:id/repository/branches/:branch + delete ":id/repository/branches/:branch" do + authorize_push_project + DeleteBranchService.new.execute(user_project, params[:branch], current_user) + end end end end -- GitLab From 36cac35b24d7b8318de40bd2e495b8807eef48fc Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 15:38:47 +0300 Subject: [PATCH 228/237] Dont allow remove of protected branch Signed-off-by: Dmitriy Zaporozhets --- lib/gitlab/git_access.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index 4f49ca4189e..2f8b55aaca0 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -44,14 +44,18 @@ module Gitlab def push_allowed?(user, project, ref, oldrev, newrev, forced_push) if user && user_allowed?(user) action = if project.protected_branch?(ref) - if forced_push.to_s == 'true' - :force_push_code_to_protected_branches - else - :push_code_to_protected_branches - end - else - :push_code - end + # we dont allow force push to protected branch + if forced_push.to_s == 'true' + :force_push_code_to_protected_branches + # and we dont allow remove of protected branch + elsif newrev =~ /0000000/ + :remove_protected_branches + else + :push_code_to_protected_branches + end + else + :push_code + end user.can?(action, project) else false -- GitLab From 3296fb9f3a30fab41bac61b2afbe689cfcbbd15f Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 22 May 2014 16:27:32 +0200 Subject: [PATCH 229/237] Add missing lines in update guide. --- doc/update/6.8-to-6.9.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/update/6.8-to-6.9.md b/doc/update/6.8-to-6.9.md index a5e644b8a07..4a3e45ae5ee 100644 --- a/doc/update/6.8-to-6.9.md +++ b/doc/update/6.8-to-6.9.md @@ -52,6 +52,12 @@ sudo -u git -H bundle install --without development test postgres --deployment # PostgreSQL installations (note: the line below states '--without ... mysql') sudo -u git -H bundle install --without development test mysql --deployment + +# Run database migrations +sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production + +# Clean up assets and cache +sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production ``` ### 5. Update config files -- GitLab From 74079fe2369c20767cb6c639eec1886c9822fefc Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 18:19:50 +0300 Subject: [PATCH 230/237] Fix scroll to highlighted line. Replace scrollTO js file with gem Signed-off-by: Dmitriy Zaporozhets --- Gemfile | 1 + Gemfile.lock | 3 + app/assets/javascripts/application.js.coffee | 2 +- app/assets/javascripts/blob.js.coffee | 2 +- vendor/assets/javascripts/jquery.scrollto.js | 225 ------------------- 5 files changed, 6 insertions(+), 227 deletions(-) delete mode 100644 vendor/assets/javascripts/jquery.scrollto.js diff --git a/Gemfile b/Gemfile index 7ff7515143c..f7e3fe7b6dd 100644 --- a/Gemfile +++ b/Gemfile @@ -163,6 +163,7 @@ gem 'select2-rails' gem 'jquery-atwho-rails', "~> 0.3.3" gem "jquery-rails" gem "jquery-ui-rails" +gem "jquery-scrollto-rails" gem "raphael-rails", "~> 2.1.2" gem 'bootstrap-sass', '~> 3.0' gem "font-awesome-rails", '~> 3.2' diff --git a/Gemfile.lock b/Gemfile.lock index f5f31105e18..86c752505bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -250,6 +250,8 @@ GEM jquery-rails (3.1.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) + jquery-scrollto-rails (1.4.3) + railties (> 3.1, < 5.0) jquery-turbolinks (2.0.1) railties (>= 3.1.0) turbolinks @@ -607,6 +609,7 @@ DEPENDENCIES jasmine (= 2.0.0.rc5) jquery-atwho-rails (~> 0.3.3) jquery-rails + jquery-scrollto-rails jquery-turbolinks jquery-ui-rails kaminari (~> 0.15.1) diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee index a22ff6dec31..587e51a7a83 100644 --- a/app/assets/javascripts/application.js.coffee +++ b/app/assets/javascripts/application.js.coffee @@ -13,7 +13,7 @@ #= require jquery.history #= require jquery.waitforimages #= require jquery.atwho -#= require jquery.scrollto +#= require jquery.scrollTo #= require jquery.blockUI #= require turbolinks #= require jquery.turbolinks diff --git a/app/assets/javascripts/blob.js.coffee b/app/assets/javascripts/blob.js.coffee index 584f6faea16..9db919e5a62 100644 --- a/app/assets/javascripts/blob.js.coffee +++ b/app/assets/javascripts/blob.js.coffee @@ -26,7 +26,7 @@ class BlobView unless isNaN first_line $("#tree-content-holder .highlight .line").removeClass("hll") $("#LC#{line}").addClass("hll") for line in [first_line..last_line] - $("#L#{first_line}").ScrollTo() unless e? + $.scrollTo("#L#{first_line}") unless e? # parse selected lines from hash # always return first and last line (initialized to NaN) diff --git a/vendor/assets/javascripts/jquery.scrollto.js b/vendor/assets/javascripts/jquery.scrollto.js deleted file mode 100644 index 7f10b7f1082..00000000000 --- a/vendor/assets/javascripts/jquery.scrollto.js +++ /dev/null @@ -1,225 +0,0 @@ -/** - * @depends jquery - * @name jquery.scrollto - * @package jquery-scrollto {@link http://balupton.com/projects/jquery-scrollto} - */ - -/** - * jQuery Aliaser - */ -(function(window,undefined){ - // Prepare - var jQuery, $, ScrollTo; - jQuery = $ = window.jQuery; - - /** - * jQuery ScrollTo (balupton edition) - * @version 1.2.0 - * @date July 9, 2012 - * @since 0.1.0, August 27, 2010 - * @package jquery-scrollto {@link http://balupton.com/projects/jquery-scrollto} - * @author Benjamin "balupton" Lupton {@link http://balupton.com} - * @copyright (c) 2010 Benjamin Arthur Lupton {@link http://balupton.com} - * @license MIT License {@link http://creativecommons.org/licenses/MIT/} - */ - ScrollTo = $.ScrollTo = $.ScrollTo || { - /** - * The Default Configuration - */ - config: { - duration: 400, - easing: 'swing', - callback: undefined, - durationMode: 'each', - offsetTop: 0, - offsetLeft: 0 - }, - - /** - * Configure ScrollTo - */ - configure: function(options){ - // Apply Options to Config - $.extend(ScrollTo.config, options||{}); - - // Chain - return this; - }, - - /** - * Perform the Scroll Animation for the Collections - * We use $inline here, so we can determine the actual offset start for each overflow:scroll item - * Each collection is for each overflow:scroll item - */ - scroll: function(collections, config){ - // Prepare - var collection, $container, container, $target, $inline, position, - containerScrollTop, containerScrollLeft, - containerScrollTopEnd, containerScrollLeftEnd, - startOffsetTop, targetOffsetTop, targetOffsetTopAdjusted, - startOffsetLeft, targetOffsetLeft, targetOffsetLeftAdjusted, - scrollOptions, - callback; - - // Determine the Scroll - collection = collections.pop(); - $container = collection.$container; - container = $container.get(0); - $target = collection.$target; - - // Prepare the Inline Element of the Container - $inline = $('').css({ - 'position': 'absolute', - 'top': '0px', - 'left': '0px' - }); - position = $container.css('position'); - - // Insert the Inline Element of the Container - $container.css('position','relative'); - $inline.appendTo($container); - - // Determine the top offset - startOffsetTop = $inline.offset().top; - targetOffsetTop = $target.offset().top; - targetOffsetTopAdjusted = targetOffsetTop - startOffsetTop - parseInt(config.offsetTop,10); - - // Determine the left offset - startOffsetLeft = $inline.offset().left; - targetOffsetLeft = $target.offset().left; - targetOffsetLeftAdjusted = targetOffsetLeft - startOffsetLeft - parseInt(config.offsetLeft,10); - - // Determine current scroll positions - containerScrollTop = container.scrollTop; - containerScrollLeft = container.scrollLeft; - - // Reset the Inline Element of the Container - $inline.remove(); - $container.css('position',position); - - // Prepare the scroll options - scrollOptions = {}; - - // Prepare the callback - callback = function(event){ - // Check - if ( collections.length === 0 ) { - // Callback - if ( typeof config.callback === 'function' ) { - config.callback.apply(this,[event]); - } - } - else { - // Recurse - ScrollTo.scroll(collections,config); - } - // Return true - return true; - }; - - // Handle if we only want to scroll if we are outside the viewport - if ( config.onlyIfOutside ) { - // Determine current scroll positions - containerScrollTopEnd = containerScrollTop + $container.height(); - containerScrollLeftEnd = containerScrollLeft + $container.width(); - - // Check if we are in the range of the visible area of the container - if ( containerScrollTop < targetOffsetTopAdjusted && targetOffsetTopAdjusted < containerScrollTopEnd ) { - targetOffsetTopAdjusted = containerScrollTop; - } - if ( containerScrollLeft < targetOffsetLeftAdjusted && targetOffsetLeftAdjusted < containerScrollLeftEnd ) { - targetOffsetLeftAdjusted = containerScrollLeft; - } - } - - // Determine the scroll options - if ( targetOffsetTopAdjusted !== containerScrollTop ) { - scrollOptions.scrollTop = targetOffsetTopAdjusted; - } - if ( targetOffsetLeftAdjusted !== containerScrollLeft ) { - scrollOptions.scrollLeft = targetOffsetLeftAdjusted; - } - - // Perform the scroll - if ( $.browser.safari && container === document.body ) { - window.scrollTo(scrollOptions.scrollLeft, scrollOptions.scrollTop); - callback(); - } - else if ( scrollOptions.scrollTop || scrollOptions.scrollLeft ) { - $container.animate(scrollOptions, config.duration, config.easing, callback); - } - else { - callback(); - } - - // Return true - return true; - }, - - /** - * ScrollTo the Element using the Options - */ - fn: function(options){ - // Prepare - var collections, config, $container, container; - collections = []; - - // Prepare - var $target = $(this); - if ( $target.length === 0 ) { - // Chain - return this; - } - - // Handle Options - config = $.extend({},ScrollTo.config,options); - - // Fetch - $container = $target.parent(); - container = $container.get(0); - - // Cycle through the containers - while ( ($container.length === 1) && (container !== document.body) && (container !== document) ) { - // Check Container for scroll differences - var scrollTop, scrollLeft; - scrollTop = $container.css('overflow-y') !== 'visible' && container.scrollHeight !== container.clientHeight; - scrollLeft = $container.css('overflow-x') !== 'visible' && container.scrollWidth !== container.clientWidth; - if ( scrollTop || scrollLeft ) { - // Push the Collection - collections.push({ - '$container': $container, - '$target': $target - }); - // Update the Target - $target = $container; - } - // Update the Container - $container = $container.parent(); - container = $container.get(0); - } - - // Add the final collection - collections.push({ - '$container': $( - ($.browser.msie || $.browser.mozilla) ? 'html' : 'body' - ), - '$target': $target - }); - - // Adjust the Config - if ( config.durationMode === 'all' ) { - config.duration /= collections.length; - } - - // Handle - ScrollTo.scroll(collections,config); - - // Chain - return this; - } - }; - - // Apply our jQuery Prototype Function - $.fn.ScrollTo = $.ScrollTo.fn; - -})(window); -- GitLab From b9d1fc2f3bdebe541795d6ef6e94da9e98b043d3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 18:31:22 +0300 Subject: [PATCH 231/237] Improve protected branch explanation Signed-off-by: Dmitriy Zaporozhets --- app/views/projects/protected_branches/index.html.haml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/projects/protected_branches/index.html.haml b/app/views/projects/protected_branches/index.html.haml index 4a6e8943a9f..e9f67b671bf 100644 --- a/app/views/projects/protected_branches/index.html.haml +++ b/app/views/projects/protected_branches/index.html.haml @@ -4,12 +4,12 @@ = render "projects/branches/filter" .col-md-9 .bs-callout.bs-callout-info - %p Protected branches designed to prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}. - %p This ability allows: + %p Protected branches designed to %ul - %li keep stable branches secured - %li forced code review before merge to protected branches - %li prevents branch from force push + %li prevent push for all except #{link_to "masters", help_permissions_path, class: "vlink"}. + %li prevent branch from force push + %li prevent branch from removal + %p This ability allows to keep stable branches secured and force code review before merge to protected branches %p Read more about project permissions #{link_to "here", help_permissions_path, class: "underlined-link"} - if can? current_user, :admin_project, @project -- GitLab From babfc068ae2747ce578a90c7cb22fd88f03349bd Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 20:34:03 +0300 Subject: [PATCH 232/237] Lets start 7.0 development Signed-off-by: Dmitriy Zaporozhets --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 97f57815281..2e45d00c582 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.9.0 +7.0.0.pre -- GitLab From 8bf7b62e8169fc1e2b9cf66edd9a66232f285270 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 20:40:25 +0300 Subject: [PATCH 233/237] First entries for 7.0 CHANGELOG Signed-off-by: Dmitriy Zaporozhets --- CHANGELOG | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index aaf1879dcce..ca0b96b8402 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +v 7.0.0 + - The CPU no longer overheats when you hold down the spacebar + - Improve edit file UI + - Add ability to upload group avatar when create + v 6.9.0 - Store Rails cache data in the Redis `cache:gitlab` namespace - Adjust MySQL limits for existing installations -- GitLab From b192aa5694b8df233124c4be58802a9100b0c321 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 22:34:34 +0300 Subject: [PATCH 234/237] Fix tests Signed-off-by: Dmitriy Zaporozhets --- app/controllers/projects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index ebb8a90c630..e356d09a270 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -190,6 +190,6 @@ class ProjectsController < ApplicationController end def sorted(users) - users.uniq.sort_by(&:username).map { |user| { username: user.username, name: user.name } } + users.uniq.compact.sort_by(&:username).map { |user| { username: user.username, name: user.name } } end end -- GitLab From ebe2a34a6b81f468187a8049ddae8242b00d1ebe Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 22 May 2014 22:44:32 +0300 Subject: [PATCH 235/237] Add missing feature flag to mr notes spec Signed-off-by: Dmitriy Zaporozhets --- spec/features/notes_on_merge_requests_spec.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index cfb6deb1834..45aebf128c2 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -132,7 +132,7 @@ describe "On a merge request", js: true, feature: true do end end -describe "On a merge request diff", js: true do +describe "On a merge request diff", js: true, feature: true do let(:merge_request) { create(:merge_request, :with_diffs, :simple) } let(:project) { merge_request.source_project } @@ -210,9 +210,3 @@ describe "On a merge request diff", js: true do end end end - -describe "On merge request discussion", js: true do - describe "with merge request diff note" - describe "with commit note" - describe "with commit diff note" -end -- GitLab From 696b9903f08011e37811dc8b8ff4f7da77201d13 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 23 May 2014 09:47:58 +0300 Subject: [PATCH 236/237] Fix spinach tests Signed-off-by: Dmitriy Zaporozhets --- features/steps/group/group.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb index 820d0ef2a1f..5e0c71581f1 100644 --- a/features/steps/group/group.rb +++ b/features/steps/group/group.rb @@ -89,7 +89,7 @@ class Groups < Spinach::FeatureSteps Then 'I should see newly created group "Samurai"' do page.should have_content "Samurai" page.should have_content "Tokugawa Shogunate" - page.should have_content "You will only see events from projects in this group" + page.should have_content "Currently you are only seeing events from the" end And 'I change group "Owned" name to "new-name"' do -- GitLab From 595c8ee67fecbb3879bd60b409d36b1421258012 Mon Sep 17 00:00:00 2001 From: Marvin Frick Date: Fri, 9 May 2014 14:26:19 +0200 Subject: [PATCH 237/237] fixes gitlab.com issue #229 Changes .js.coffe files to not use a hardcoded path to `no_avatar.png` but instead stick with the asset pipeline. renames coffee.erb back to coffee --- app/assets/javascripts/project_users_select.js.coffee | 2 +- app/assets/javascripts/users_select.js.coffee | 2 +- app/helpers/application_helper.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/project_users_select.js.coffee b/app/assets/javascripts/project_users_select.js.coffee index a7fec960406..382f9b37992 100644 --- a/app/assets/javascripts/project_users_select.js.coffee +++ b/app/assets/javascripts/project_users_select.js.coffee @@ -43,7 +43,7 @@ avatar = avatar.replace('%{hash}', md5(user.email)) avatar = avatar.replace('%{size}', '24') else - avatar = gon.relative_url_root + "/assets/no_avatar.png" + avatar = gon.relative_url_root + "#{image_path('no_avatar.png')}" if user.id == '' avatarMarkup = '' diff --git a/app/assets/javascripts/users_select.js.coffee b/app/assets/javascripts/users_select.js.coffee index cab9f6271eb..da66a4ba7f2 100644 --- a/app/assets/javascripts/users_select.js.coffee +++ b/app/assets/javascripts/users_select.js.coffee @@ -7,7 +7,7 @@ $ -> avatar = avatar.replace('%{hash}', md5(user.email)) avatar = avatar.replace('%{size}', '24') else - avatar = gon.relative_url_root + "/assets/no_avatar.png" + avatar = gon.relative_url_root + "#{image_path('no_avatar.png')}" "
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5f07cdf448c..e87bf24163a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -71,7 +71,7 @@ module ApplicationHelper size = 40 if size.nil? || size <= 0 if !Gitlab.config.gravatar.enabled || user_email.blank? - '/assets/no_avatar.png' + image_path('no_avatar.png') else gravatar_url = request.ssl? || gitlab_config.https ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url user_email.strip! -- GitLab