From 556ae5ae8187b89a3785219d5621e7ebc9bb7a8c Mon Sep 17 00:00:00 2001 From: Javier Castro Date: Tue, 14 Jan 2014 12:06:53 -0300 Subject: [PATCH 001/141] 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 db5f3ebb00..ad2afbce14 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 fd2a3f4367..be9c6ca79b 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 From 07a9d44de7a54b2cd1bffd9fcc830f7b2a03b549 Mon Sep 17 00:00:00 2001 From: Ciro Santillli Date: Sat, 22 Feb 2014 20:27:23 +0100 Subject: [PATCH 002/141] 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 56cd4db905..36551f85b6 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 55a5819b55..86e2a51641 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 6384703671..692248dd23 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 3f2e98f3a7..41a63493b2 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 6594709f2a..43157481f3 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 9d7c7afbea..9ecbbe7508 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 0000000000..cca7a0efc9 --- /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 From 5ef7fdbd54ef41de01b64b4df58529d4bf3c62a3 Mon Sep 17 00:00:00 2001 From: George Dewar Date: Thu, 17 Apr 2014 14:36:43 +1200 Subject: [PATCH 003/141] 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 c6e4f574b6..b02be4623f 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 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 004/141] 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 0000000000..56d8d51394 --- /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 +``` From b5a73b1f902c97c3289df159b1007eb4a0db9eac Mon Sep 17 00:00:00 2001 From: Marcus Ilgner Date: Fri, 18 Apr 2014 17:55:06 +0200 Subject: [PATCH 005/141] 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 abe6fceff1..c1bd6d02c6 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 From 61e68634033219cb9620ef11078bc90254f1b553 Mon Sep 17 00:00:00 2001 From: Marcus Ilgner Date: Sun, 20 Apr 2014 12:01:55 +0200 Subject: [PATCH 006/141] 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 40bcc6e2cd..ffaba0af7f 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 } ``` From d1648a6a2150c26c12a4f108040676a49627b8a0 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Wed, 23 Apr 2014 21:58:58 +0300 Subject: [PATCH 007/141] 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 579656eda2..5924033c95 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; From 0050c07fdda59f36ca2959e08d422ff5d6479e10 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 24 Apr 2014 15:00:18 +0200 Subject: [PATCH 008/141] 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 bcd9e0d521..0eb9364eaa 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) From 84870438f95092957c2ad5ca4581e2b95f98033d Mon Sep 17 00:00:00 2001 From: Chenguang Zhang Date: Thu, 24 Apr 2014 16:49:01 +0800 Subject: [PATCH 009/141] 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 | 79 ++++++++----------- .../_diff_notes_with_reply_parallel.html.haml | 21 +++-- 4 files changed, 50 insertions(+), 76 deletions(-) diff --git a/app/assets/stylesheets/sections/diff.scss b/app/assets/stylesheets/sections/diff.scss index fe285f94bd..64e669ac2b 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 c9c7b6ecce..7e56781f56 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 5b60ab80ba..80f5be98f2 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 - %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 + -# 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 - %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 + - 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 - %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 2012aa021b..399ce30d1a 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= "" + 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 010/141] 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 284e4e1659..d57934891d 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: -## Make upgrade guide +* 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 -### From x.x to x.x +# 15th - Code Freeze & Release Manager -#### 0. Any major changes? Database updates? Web server change? File structure changes? +- 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. + +### 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. + +#### 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 From ccdf7a329a3eb483a6ec2f9c68d77f5697844f0d Mon Sep 17 00:00:00 2001 From: Adam Engebretson Date: Fri, 25 Apr 2014 03:38:54 +0000 Subject: [PATCH 011/141] 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 b1740f3579..5f848e0f4b 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 From c4b1a5f5ea338d9be6b24f29a562b567b3c2598b Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 28 Apr 2014 16:22:31 +0200 Subject: [PATCH 012/141] 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 163302a18f..08a5278247 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 76f311ed0b..c95b82734a 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 8cb7fa8aa0..1ce292a02d 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 f23542cc89..3e32068d8f 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' From 17b3da07ce90c0651303b4605a2ef634359b42b3 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Mon, 28 Apr 2014 14:33:17 -0500 Subject: [PATCH 013/141] 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 a97d55f1b5..1130969a26 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 ccbdadf010..2a877bc159 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 809d46f31b..574e8bfef2 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 ee434ec8cb..d6b76e906c 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 0c62d439ae..6762fae7f6 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 550f677fed..360da60bc3 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)} From cb69baedd335b0609503502080fc684520b3794c Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 30 Apr 2014 11:48:46 +0200 Subject: [PATCH 014/141] 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 c95b82734a..535bfb5b28 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 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 015/141] 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 d57934891d..2bd1b2f4f4 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. From d210484205c51e12e63ea0ad20cd10b7ef3f7057 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Fri, 2 May 2014 17:14:58 -0500 Subject: [PATCH 016/141] 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 bf37e70820..fba56b5dc3 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' 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 017/141] 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 2bd1b2f4f4..8c3a432d25 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** From 73801a746362e4c284f323e415c1853eed77ba56 Mon Sep 17 00:00:00 2001 From: Marc Radulescu Date: Mon, 5 May 2014 10:04:52 +0200 Subject: [PATCH 018/141] 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 62e21dc72b..0fe015b2d3 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 From 4146e885dde2338b25c1a176ede2f5a2d0946f96 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 5 May 2014 11:55:49 +0200 Subject: [PATCH 019/141] 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 0eb9364eaa..496064c9a6 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) From ad0f5fdc2729ac26268c2638c064abbf14134688 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Thu, 27 Mar 2014 17:05:15 -0500 Subject: [PATCH 020/141] 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 1e9aeefd19..d3561d2efc 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 3db4d908d9..ccdcc65794 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 d4f8c8108a..3c48361b2e 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 13f811e01a..d683e33e1f 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 aae101cf40..425dcb45dd 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 124eb53571..b6d3a8edf4 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 2bd850426a..5c6734fd24 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 8855982a2e..435e916c6d 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 7676fc137c..8f78e93df4 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 From cac916d974cf12083002d01488dfd3ca8ac2a89a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 5 May 2014 14:21:00 +0300 Subject: [PATCH 021/141] 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 c6e4d3351c..05123ad9c4 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 From 4f670fbe9c83bdf20e1a58d3166848ab6d453b6c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 5 May 2014 14:30:50 +0300 Subject: [PATCH 022/141] 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 9303ab9330..164bb63780 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 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 023/141] remove redundancy, remove really good joke, add step to release --- doc/release/monthly.md | 47 +++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/doc/release/monthly.md b/doc/release/monthly.md index b9c39ba323..44802c347f 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** +### **8. Push to remotes** + +For GitLab CE, push to dev, GitLab.com and GitHub. + +For GitLab EE, push to the subscribers repo. + +NOTE: You might not have the rights to push to master on dev. Ask Dmitriy. + +### **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. -### **9. Tweet to blog** +### **10. 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. - -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** +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** From 5a949e609512cdabd7885712a37e04095d1f4600 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 5 May 2014 13:47:47 +0200 Subject: [PATCH 024/141] 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 90eb2b79c6..41c51f2c42 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 a819ee37d7..4195ce5b28 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 From fac225780cf5579a566977ee78e320ad3f40fd0e Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 5 May 2014 14:01:48 +0200 Subject: [PATCH 025/141] 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 535bfb5b28..b8a0a9eb58 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 From f5c4bda8fe53549f2ba63484359543f272954a61 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 5 May 2014 15:07:19 +0300 Subject: [PATCH 026/141] Improve MR seeds Signed-off-by: Dmitriy Zaporozhets --- db/fixtures/development/10_merge_requests.rb | 60 ++++++++------------ 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/db/fixtures/development/10_merge_requests.rb b/db/fixtures/development/10_merge_requests.rb index cb08a7c253..62fd0d84ea 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 + Project.all.reject(&:empty_repo?).each do |project| + branches = project.repository.branch_names - # Random user - user = project.team.users.sample + branches.each do |branch_name| + break if branches.size < 2 + source_branch = branches.pop + target_branch = branches.pop - next unless user + # Random user + user = project.team.users.sample + next unless user - next if project.empty_repo? + params = { + source_branch: source_branch, + target_branch: target_branch, + title: Faker::Lorem.sentence(6), + description: Faker::Lorem.sentences(3).join(" ") + } - branches = project.repository.branch_names.sample(2) + merge_request = MergeRequests::CreateService.new(project, user, params).execute - 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) - }]) + 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 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 027/141] 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 56d8d51394..f4121a718e 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 ``` 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 028/141] 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 44802c347f..514d73517b 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. From 06bed543e69c16d4c267d1bd49e879c3e9b761e9 Mon Sep 17 00:00:00 2001 From: Philip Blatter Date: Wed, 22 Jan 2014 01:34:39 +0100 Subject: [PATCH 029/141] 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 d684e35445..a096df9dc0 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 a97d55f1b5..994ce692a0 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 ccbdadf010..43858ea024 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 554f53cf14..84a0da0129 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 From 11bedfe37d4a19d6aa22a45fbce6622bbbb09cb6 Mon Sep 17 00:00:00 2001 From: Philip Blatter Date: Tue, 4 Mar 2014 15:14:38 +0100 Subject: [PATCH 030/141] 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 43858ea024..d2db881cfc 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})")) From a7bdf87f434a09afd7e96c2e7f99cc3fc5be9a07 Mon Sep 17 00:00:00 2001 From: Philip Blatter Date: Tue, 4 Mar 2014 15:14:58 +0100 Subject: [PATCH 031/141] 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 e86a60a42b..7a2fe750f4 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 From de576be52e6a05b6db95d2559a53b71c249be5c4 Mon Sep 17 00:00:00 2001 From: maiki Date: Mon, 5 May 2014 15:47:56 -0700 Subject: [PATCH 032/141] 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 bf9d2784af..76d83e6f3b 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 From fd7a221cca9d5ac5338b265fb66b280e205b6330 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 6 May 2014 09:07:15 +0300 Subject: [PATCH 033/141] 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 2c9b997893..9516210e20 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 From b96ad52e10151fed49f63b107ce6871c8d25647e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 6 May 2014 09:07:15 +0300 Subject: [PATCH 034/141] 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 2c9b997893..9516210e20 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 From 00cd3ecc44a6c6d29565c95cd5173c8e5de35537 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 6 May 2014 09:57:08 +0200 Subject: [PATCH 035/141] 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 4195ce5b28..3244a5a05a 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 From b1d68b6e9bd837b3b685b76ceca1b6a44cf2dc17 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Tue, 1 Apr 2014 15:39:26 +0100 Subject: [PATCH 036/141] 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 0000000000..09cb83783d --- /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 0000000000..126f9fda72 --- /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 From 402361afff4a4eb8c19ea7ab4f4c6ec5daf64221 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Tue, 15 Apr 2014 17:58:12 +0100 Subject: [PATCH 037/141] 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 126f9fda72..283abb6a0c 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 From 536b2f2f75d384446e4d3d103903a6ff909bd4da Mon Sep 17 00:00:00 2001 From: Ahmed Shafeeq Date: Tue, 6 May 2014 22:02:21 +0800 Subject: [PATCH 038/141] 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 90d6f0e17e..a441d2b65a 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 From 14102fd2112dba60795421726bbf6d59dac273da Mon Sep 17 00:00:00 2001 From: Ahmed Shafeeq Date: Wed, 7 May 2014 01:14:00 +0800 Subject: [PATCH 039/141] 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 a441d2b65a..28758197f3 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:** From fa7d0e3ae0bcc1f2aa4a46b0ca3b80e78d3c3c46 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 May 2014 12:21:02 +0300 Subject: [PATCH 040/141] 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 c9ecbceaf5..80fe540489 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) + From 99e0d0dd6f9d1a6b66c5322f142e6dd008f62ebd Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 7 May 2014 11:52:07 +0200 Subject: [PATCH 041/141] 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 41c51f2c42..4a8c771dda 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 3244a5a05a..96f2505d24 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 From c9104fa6e435a713dcdeb6de9db15079b4851aa7 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 May 2014 14:26:49 +0300 Subject: [PATCH 042/141] 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 4a9341e8f5..6b29accb31 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; + } +} From 18529269c6adf102d2e521bd5241794ea2347b55 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 May 2014 14:43:07 +0300 Subject: [PATCH 043/141] 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 980ac12674..d1cab89a35 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)} From 97eb2240b1e401bf75408b9cc6b1560bc52ab849 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 May 2014 14:52:43 +0300 Subject: [PATCH 044/141] 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 3c48361b2e..02c9123178 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 { From 4fea8afc4bc507bf94d93c1ef04a9575add900ab Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 7 May 2014 16:14:24 +0300 Subject: [PATCH 045/141] 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 0684461add..7dce71a677 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 0000000000..c923bb9c0f --- /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 From a8624cbe5927ceed786b5aa68fe9e917b1d8cbee Mon Sep 17 00:00:00 2001 From: skv-headless Date: Wed, 7 May 2014 17:50:56 +0400 Subject: [PATCH 046/141] 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 8b15200563..47989010d1 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: -> From 9e805b77544df5be602d0c218d7be1047eb6729f Mon Sep 17 00:00:00 2001 From: "C. Morgan Hamill" Date: Wed, 7 May 2014 16:33:54 -0400 Subject: [PATCH 047/141] 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 1bac93378e..c6f56c141e 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 From a45f7262f9a3e26361b6fde4f77d0d27437535cf Mon Sep 17 00:00:00 2001 From: "C. Morgan Hamill" Date: Wed, 7 May 2014 16:41:35 -0400 Subject: [PATCH 048/141] 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 c6f56c141e..e9e57aa574 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 From 5f74f0511fbf75b719528d55f7d1f5d7c52f21b8 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 8 May 2014 09:13:41 +0200 Subject: [PATCH 049/141] 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 3564566326..f4513af7a8 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) From c01efa0ed5a9dadd2daf8cc63c5612864c771f23 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 12:10:04 +0200 Subject: [PATCH 050/141] 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 d3561d2efc..cc271f5e2c 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 9a324545eb..cdef7d71e3 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. +``` From da9b009d31ee342d96da7b8796b937849de650cd Mon Sep 17 00:00:00 2001 From: Sean Edge Date: Tue, 6 May 2014 17:28:21 -0400 Subject: [PATCH 051/141] 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 953c6100f8..d54f9371fb 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]) From 92591b63dcba5115537cd1e6da714540590975b8 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 13:18:12 +0200 Subject: [PATCH 052/141] 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 cdef7d71e3..661dcc02ba 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 From 3bfbea37e9a0cca64bf67e0a8a8ce3ceb9b9db55 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 13:18:22 +0200 Subject: [PATCH 053/141] 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 661dcc02ba..5b9209d7df 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 From 5014a5b7d51f329311b80f8c0770b11616812120 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 13:59:31 +0200 Subject: [PATCH 054/141] 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 3564566326..20fcc3964a 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) From 23de3551ab1ece5a3782c07d3a88a092122431d0 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:37:36 +0300 Subject: [PATCH 055/141] 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 8c885b70a4..134a8c8dd4 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 From 05e63fe09c8a44ed14d4282db81d18927ce1a5ad Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:38:17 +0300 Subject: [PATCH 056/141] 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 0000000000..47b8e5c886 --- /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 0000000000..ea79b78e76 --- /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 8ee0e1a8d4..c24e591672 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' From 8eae01ea58c505a3c132e3d4f09cf77e7c1fc574 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:38:52 +0300 Subject: [PATCH 057/141] 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 745da9c49e..d8551db7b0 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 From 51e976d295edfefd5e2cb2dfc7967fb90c87ac40 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:40:02 +0300 Subject: [PATCH 058/141] 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 0fe2d1d980..58994e012f 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 693c2057a0..8372afa61b 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 8f78e93df4..2c905413bc 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 From ee3cd06f4cdf0c150801b1268d806b8a252960f5 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:40:19 +0300 Subject: [PATCH 059/141] 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 790496a1a5..5dcfc449b4 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; From 2da289cf22995d14e275b7c908b7e6014a11c7d9 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 15:52:59 +0300 Subject: [PATCH 060/141] 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 03fad41c49..b0e39610fe 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 95f0eff58b..7c58908165 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 a1fe4488ae..ab24367c45 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 58994e012f..ddff3dbead 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 ea79b78e76..e6e0db55d9 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(); + }); From 700b6366db9d4ee0bf8d6e9e0e47519ae46e40c6 Mon Sep 17 00:00:00 2001 From: Jeroen van Baarsen Date: Thu, 8 May 2014 14:57:42 +0200 Subject: [PATCH 061/141] 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 cb755a411e..c7c979c0ca 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 From 04561011177f5323f4fe0e18e7a0137d72b314ea Mon Sep 17 00:00:00 2001 From: "C. Morgan Hamill" Date: Thu, 8 May 2014 09:23:17 -0400 Subject: [PATCH 062/141] 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 e9e57aa574..7f1d1cd653 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 From ad5a982d841f572e4e9207ae5ac6a0013648d30e Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Thu, 8 May 2014 15:00:20 +0200 Subject: [PATCH 063/141] 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 3563dc88e3..7ff7515143 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 20fcc3964a..c04c1e2b56 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 From 86bf684f5dc95e8bd2445f088f862d0a0539922a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 16:30:39 +0300 Subject: [PATCH 064/141] 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 47b8e5c886..6f6f54ccec 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 e6e0db55d9..b5479be708 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 f42eb6377c..e0aec699a5 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 From 536373ad05b55c69442e7d7d6cb549791031cac2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 19:00:03 +0300 Subject: [PATCH 065/141] 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 6f6f54ccec..a8b774a3cd 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 2d94b98c90..5832b729de 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 df69cb7543..3c497638d9 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 From 41231862baeb01dc6ed49f68488e863bca6dbfb2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 19:23:39 +0300 Subject: [PATCH 066/141] 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 394acd3fe8..706c9babce 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 From da347d1bb45ad3b08b2aa0b40041c67dac0df3c5 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 11:02:04 +0200 Subject: [PATCH 067/141] 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 cc271f5e2c..61eb24f1c5 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 05814fc78f..28e323fe30 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 From 20be9ef251ff0d1e865f1ec5090ee151a24135bb Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 21:09:51 +0300 Subject: [PATCH 068/141] 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 fcc7374d0d..147c759ecb 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); From 2ec1a879f7cb96370a54f379c39a88b75b67f4c7 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 21:10:07 +0300 Subject: [PATCH 069/141] 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 ccdcc65794..d4d3361bc7 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; From 211e975d8acbc046219fefbf95a12a8f0bbf980b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 8 May 2014 21:10:20 +0300 Subject: [PATCH 070/141] 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 1e22d161bf..8a337a5e20 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; From 0f29ccffd2b9805545db63d8266bb8367de1e35c Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 8 May 2014 22:49:27 +0200 Subject: [PATCH 071/141] 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 61eb24f1c5..e43edc5d7a 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 214d9824ee..6f7c4f7c90 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 From 3b34084bdeadecdceb0a86e2820dd7c5985099f6 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 9 May 2014 09:46:23 +0300 Subject: [PATCH 072/141] 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 e86a60a42b..3b07504495 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 From ea696805a7a82ec6a70da1dd7d5bc010f035ea26 Mon Sep 17 00:00:00 2001 From: Gregoire Daussin Date: Fri, 9 May 2014 17:58:23 +0200 Subject: [PATCH 073/141] 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 a441955173..8cc72d7f07 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 06cf994678..5c5df46d33 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 From 049b63473f827e3d28b0128356b81b3208bf0b0c Mon Sep 17 00:00:00 2001 From: dosire Date: Fri, 9 May 2014 19:34:25 +0200 Subject: [PATCH 074/141] 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 a2aa9add9a..eea5c763fc 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 From 7477dd7a7ca68b6f5365068e34c854381096da3c Mon Sep 17 00:00:00 2001 From: Pascal Herbert Date: Sun, 11 May 2014 13:23:51 +0000 Subject: [PATCH 075/141] 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 0fe015b2d3..dc21a7e55a 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 From a3d8be09c6c62e39301d82e47b710717ff68245f Mon Sep 17 00:00:00 2001 From: sue445 Date: Fri, 18 Apr 2014 00:13:31 +0900 Subject: [PATCH 076/141] 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 e43edc5d7a..3188b6e962 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 6594709f2a..6ca801b17b 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 7a33686b81..7641fe4308 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 97f7392e50..fa9762625d 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 From 566badbaee55b7df45c7d912f80c372b6118b6ee Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Fri, 9 May 2014 11:37:27 +0200 Subject: [PATCH 077/141] 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 7f1d1cd653..d154bd8600 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 From 31b0e14981d57c2f38734872181c6dc49a2e6f5a Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 12 May 2014 10:23:24 +0100 Subject: [PATCH 078/141] 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 4969198b8c..41014f199d 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 76ca2a5991..5c8daf466a 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 f1df7e55dd..3c2eec6cfd 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 From 8b9b34f8427766c0eac65e6b16a7437acd5fcb9b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 12 May 2014 13:06:25 +0300 Subject: [PATCH 079/141] 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 e43edc5d7a..82395198f4 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 From 2efcd3013a22555965a01d170c2b3a7775d92280 Mon Sep 17 00:00:00 2001 From: dosire Date: Mon, 12 May 2014 13:57:20 +0200 Subject: [PATCH 080/141] Add changelog entry for satellite clean. --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 82395198f4..72bd698486 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 From fe6d392236fb6f1edd5dc1c33d52806cb4fa8a39 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 12 May 2014 16:34:41 +0300 Subject: [PATCH 081/141] 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 4b88b0f84c..fe615dfac0 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: From 78897ee2d2ecb6db40139ed3af1b591d96f59387 Mon Sep 17 00:00:00 2001 From: dtan4 Date: Mon, 12 May 2014 21:00:04 +0900 Subject: [PATCH 082/141] 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 9d0cafb3f0..e98167f6b6 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 From 0c73e6664389ef5af352560c2fced1fbfc650a27 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 12 May 2014 17:51:43 +0300 Subject: [PATCH 083/141] 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 fe615dfac0..f9a4037dd2 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 From 5880d7df6253fc97024005e7c32dbc41def99aaf Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 12 May 2014 18:01:22 +0300 Subject: [PATCH 084/141] 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 d5b106729c..d68f34971f 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 f9a4037dd2..3dffe7bd4d 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 From f0e46ec9178bfa51034a27067ecbf14ad97f3a37 Mon Sep 17 00:00:00 2001 From: dosire Date: Tue, 13 May 2014 07:58:12 +0200 Subject: [PATCH 085/141] 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 c7c979c0ca..ca7bec3b6d 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 From ab032256da9f24351871143058343f7463f9d7fc Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 11:01:40 +0300 Subject: [PATCH 086/141] 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 72bd698486..91a7a22fe1 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 3dffe7bd4d..7fb135b37b 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 db7c30e1ab..b47cbbee77 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 From 2d2b2da45a586bdf29e115dcb4b4f66f9a1feed0 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 13:20:10 +0300 Subject: [PATCH 087/141] 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 b47cbbee77..2fb3684fdf 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 From 5f25cdfe19c7c0a8c1ada592307e9017e2a754e1 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Mon, 14 Apr 2014 20:12:07 -0500 Subject: [PATCH 088/141] 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 790496a1a5..82a8ff4833 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 a3f39c23e0..2730e9942e 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 0166ca9ff0..b037cf5650 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 8c885b70a4..a55f3a6139 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 7ddcc73cf2..45e950f480 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 5e899d412c..51a8c911af 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 0fe2d1d980..e385fba6af 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 980ac12674..25cf489b68 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 e36a48f62c..193c600f77 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 34faebf619..12a72edb22 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 0000000000..0dabd965e5 --- /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 d82b08eeaa..7936a038be 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 abe6fceff1..1fd29acefe 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 4b88b0f84c..5fac2a3ea1 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 4b8f41a468..81e6abbb0d 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 From 51280fc76c168e146bd29b05adecae19c2892fc0 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 15:15:46 +0300 Subject: [PATCH 089/141] 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 7a696c21e4..76483d6783 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 edac4290e7..a08f3ff3d4 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; } } From 6b04a5f9108c640f638afa8055e2a5b60f926d5a Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 6 May 2014 19:51:56 +0200 Subject: [PATCH 090/141] 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 7d8312075a..e490b2f884 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 de14a3eca2..dca3d7a7be 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 5bd16d1c16..8c33ceeff2 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 19259a8b79..99fed27c79 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"] From bb89661365a3085302d7fbc0e66e991a421f73c6 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 7 May 2014 12:09:05 +0200 Subject: [PATCH 091/141] 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 8c33ceeff2..49b48d26e2 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 From caa876af90025f345d1d91466f80458b23ec0235 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 16:01:13 +0300 Subject: [PATCH 092/141] 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 6418f24d97..9e4207965f 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; } } } From b787540f71a3a7e68e940f39e7c903b0214a80e3 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 16:40:08 +0300 Subject: [PATCH 093/141] 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 64e669ac2b..af44654d5d 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; From d41fba4d374c5b586a25b755d79a410574f09062 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 13 May 2014 17:08:59 +0200 Subject: [PATCH 094/141] 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 3774910cf9..b6ec80c4c0 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 From d57889212bf5481c50076e9980c27f5a6531ec6b Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 18:41:36 +0300 Subject: [PATCH 095/141] 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 76483d6783..67aaa36938 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 b0827deb1a..17981955db 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; + } } From 636ec6d3a048957b5cb348d7ff1b0b5bc6973bbf Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 13 May 2014 17:59:08 +0200 Subject: [PATCH 096/141] 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 76b19eeb52..f087d3507b 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 b6ec80c4c0..07c9681f9a 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 ba5e5cdde0..f6c0f09b51 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 f64c8d5883..98c9163739 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 +} From c91300e4ce1f991a6070330c6fe2f7528dea3e10 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 13 May 2014 19:55:03 +0300 Subject: [PATCH 097/141] 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 147c759ecb..8143cfa2c8 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 06709bd7ef..1adbdfd979 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 17981955db..67616a4a10 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; From 24b68fdada1fbcc4874c32703aac0ca7ef1d52b4 Mon Sep 17 00:00:00 2001 From: Evgeniy Sokovikov Date: Wed, 14 May 2014 13:13:05 +0400 Subject: [PATCH 098/141] 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 47989010d1..4510718c2f 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() ) From ad7de951214fcfa9a0677b2b8bd669b5bd07d83e Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 13:48:51 +0200 Subject: [PATCH 099/141] 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 5ad0c8a138..a223d83da3 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 +- -> / +``` From fda0dff6d3bb20c6d05dee67d969354ae95244ea Mon Sep 17 00:00:00 2001 From: dosire Date: Wed, 14 May 2014 14:49:14 +0200 Subject: [PATCH 100/141] Add pullreview badge. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ca7bec3b6d..efac636c24 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/). From c4c2655c010b1095bb9c28337041d21cf3271dca Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 14 May 2014 15:02:42 +0200 Subject: [PATCH 101/141] Bump grit version. --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c022868bc2..f5f31105e1 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) 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 102/141] 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 dc21a7e55a..fd2dd16cd8 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+ From f4bca105d16e3bc47c2cd2725c519d2dcd788e70 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:10:43 +0200 Subject: [PATCH 103/141] 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 0777558d64..7bdcb4b974 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 From 982d4d51e8110bec280eb00db0fb756b062103d9 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:11:14 +0200 Subject: [PATCH 104/141] 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 7bdcb4b974..e36616f0e6 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 0000000000..c3f0733443 --- /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 From d54133b09fdb0b2e589896dc8740bb8d0c99ed54 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:14:06 +0200 Subject: [PATCH 105/141] 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 0000000000..e76cc4f2fd --- /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 From a754f0b2205d4f09092c8c7c032ad944a229be8f Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:26:58 +0200 Subject: [PATCH 106/141] 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 06b17c58f8..fa57f298e1 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 From a6e4153878eda841b0a71e5e1666e6bed0a050ae Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:32:40 +0200 Subject: [PATCH 107/141] 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 8f492e5c01..71931b79f6 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 From 11dba4cee7dc43f88c340bccd553cff0e3d874e4 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 18:54:05 +0200 Subject: [PATCH 108/141] 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 fa57f298e1..17ffde0e84 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 From 797e807249076920d6c4bb71f6258ca05ee0db34 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 19:04:00 +0200 Subject: [PATCH 109/141] 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 eefdb1833f..f3e781ac4e 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 From a966f72224427fe6830426f459d445cd19ecd5a0 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 19:08:42 +0200 Subject: [PATCH 110/141] 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 17ffde0e84..3a97944b12 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) From be1120e9681bfb83084c7aeadae3e83692901de9 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 14 May 2014 19:13:06 +0200 Subject: [PATCH 111/141] 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 71931b79f6..4e48ff1187 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 3a97944b12..9ad6618bd4 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 e76cc4f2fd..d8c107502b 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 From b024c094d3b6a2d1f81e0314dbfcfb1e6303155d Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 08:01:00 +0200 Subject: [PATCH 112/141] Add CHANGELOG entry for the AD disabled flag --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index be5da8bebf..1559a9969b 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 From 6d45909f03f6cc32f72135ce7ca7b4fd62132c15 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 09:57:21 +0200 Subject: [PATCH 113/141] 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 6f961d321b..2dcbce09b2 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 From 34fd557055e027b6423241e73b7cf26c741c0b6b Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 10:17:13 +0200 Subject: [PATCH 114/141] 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 f3e781ac4e..4f49ca4189 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 0000000000..16df21b49b --- /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 From 02b85fd2366bc6c0d3194ab68e13eb6291733c26 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 10:03:26 +0200 Subject: [PATCH 115/141] 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 7ee4b9d138..654c1f62c6 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 2dcbce09b2..a486947657 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 From 2d8c310f11f6340e043da97dfc10f268a78c2d9e Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 10:30:50 +0200 Subject: [PATCH 116/141] 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 a486947657..e2f222c0d3 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 From 223a8695be207aa1725d9ae3755e4d0396dfe9f0 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 15 May 2014 10:32:20 +0200 Subject: [PATCH 117/141] Add API access checks to CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index be5da8bebf..b1a7c3effb 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 From 0505a882991da981b4797e0a48c7c5098cd084e2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 15 May 2014 16:30:21 +0300 Subject: [PATCH 118/141] 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 e59d970bf4..863e4e3de5 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? From a3a512f2efe293aa2a6a1e4eb7edf04fd9087974 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 15 May 2014 16:30:50 +0300 Subject: [PATCH 119/141] 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 0343670c20..0c62772a5c 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 20879d6909..7e9f1122aa 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 From 474ae8a6877744108e256e5aacfffb815ce56583 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 16 May 2014 10:04:10 +0200 Subject: [PATCH 120/141] 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 457433c648..cb19d23581 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 ``` From 00a482511c20dc427b10629e8a1c993472dae2b6 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 16 May 2014 10:10:31 +0200 Subject: [PATCH 121/141] 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 0f39c037c9..61a63057d0 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 ``` From 85cecc0b2ef25ef4e4dc56583b0e202400168abb Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 16 May 2014 13:28:35 +0300 Subject: [PATCH 122/141] 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 a3019b3ac7..ddaae6f0e8 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 4e11bcba93..71c28c07a3 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 81472d1ca3..820d0ef2a1 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 From 52bd8d40667f6755828fdcc486dafbf34eb88627 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 16 May 2014 13:47:34 +0300 Subject: [PATCH 123/141] 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 d4d3361bc7..bd69241798 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 4b5fa0979b..f133777de5 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 */ From dbd88d453b8e6c78a423fa7e692004b1db6ea069 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Fri, 16 May 2014 12:57:32 +0200 Subject: [PATCH 124/141] 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 07c9681f9a..7b53a06553 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 eea5c763fc..a2615b5d52 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 2783c4153c..907c9352c5 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 a223d83da3..4c06bc4d44 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 - -> / ``` From d7cee6ed76b1892f4fe71d6f0cf6e83e8870478a Mon Sep 17 00:00:00 2001 From: Scooletz Date: Sat, 17 May 2014 00:04:09 +0200 Subject: [PATCH 125/141] .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 4c40589fd4..acd2f524be 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 From e1e9c307a6a5f0c3125fdb769ef065c55587782c Mon Sep 17 00:00:00 2001 From: dosire Date: Sat, 17 May 2014 10:41:12 +0200 Subject: [PATCH 126/141] 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 8318113ce9..4773dd8fff 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 e490b2f884..1b531aeeda 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). From 39d95b1d94968bd1fd465bde2790457e74addd06 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 19 May 2014 12:17:00 +0200 Subject: [PATCH 127/141] 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 a2615b5d52..0df9291308 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 0000000000..a5e644b8a0 --- /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. From aacd43d72dcb6d36834a055df52c283a6ce2ffa7 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Mon, 19 May 2014 12:31:20 +0200 Subject: [PATCH 128/141] 6.9.0 RC1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c0ad52beda..fed1b9285f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.9.0.pre +6.9.0.rc1 From 85c5a20352c7e739859eae8ad972f08fc61592b0 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 19 May 2014 13:34:26 +0300 Subject: [PATCH 129/141] 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 5c5df46d33..0fe5ac25b5 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) 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 130/141] 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 efac636c24..e06d0162e2 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. 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 131/141] 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 e06d0162e2..a745d120f6 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 From 126eefc5b84272e15ecdd856a97234de6ca10d0c Mon Sep 17 00:00:00 2001 From: dosire Date: Mon, 19 May 2014 14:45:55 +0200 Subject: [PATCH 132/141] 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 0df9291308..4fbba3ca4b 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 From dca537ab2902aa9936e4c29574ad540793028a76 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 19 May 2014 17:49:29 +0200 Subject: [PATCH 133/141] 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 5b9209d7df..4d591d4d4c 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 From 6be0188b5c289b1cff7f15fcfdff0ea9b8eec1ff Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Mon, 19 May 2014 17:51:58 +0200 Subject: [PATCH 134/141] 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 4d591d4d4c..acd1e33f59 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. ``` 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 135/141] 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 f4121a718e..1a5a458905 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: From 5d770882028ab98556b0d27716affc9f1b54dd55 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 20 May 2014 12:00:23 +0300 Subject: [PATCH 136/141] 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 4fbba3ca4b..44f5a28fde 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): From ce8e7d280b06a0dde196743f2fea29750f8089b1 Mon Sep 17 00:00:00 2001 From: dosire Date: Tue, 20 May 2014 14:30:25 +0200 Subject: [PATCH 137/141] Change cloud into .com --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index efac636c24..9e0f81a93e 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 From 9eb7fe6d06f39cc011fa9ee3cc8b137d60f5d90e Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 20 May 2014 16:21:30 +0300 Subject: [PATCH 138/141] 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 881a043f36..b9e6382ea8 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 From 1a4c9118aec5c25bf39cdc6db640569bf5c6d0e9 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 20 May 2014 16:22:47 +0300 Subject: [PATCH 139/141] 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 c77ed3433d..0c2e33f228 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 From 13761caead142c38c5163a3ae5d9bc650c186d71 Mon Sep 17 00:00:00 2001 From: dosire Date: Tue, 20 May 2014 20:51:35 +0200 Subject: [PATCH 140/141] 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 9e0f81a93e..4c423fb207 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 From 60053e6e2c79e47c84f1703a35e5c073249b9086 Mon Sep 17 00:00:00 2001 From: dosire Date: Wed, 21 May 2014 13:06:12 +0200 Subject: [PATCH 141/141] 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 b2bd9d8e84..cbbfebc81e 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.