diff --git a/.hound.yml b/.hound.yml new file mode 100644 index 0000000000..3bde29fb2b --- /dev/null +++ b/.hound.yml @@ -0,0 +1,4 @@ +# Prefer single quotes +StringLiterals: + EnforcedStyle: single_quotes + Enabled: true diff --git a/CHANGELOG b/CHANGELOG index 15c7be48ab..a458acc363 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,10 @@ v 7.1.0 - Show VERSION information on project sidebar - Improve branch removal logic when accept MR - Fix bug where comment form is spawned inside the Reply button + - Remove Dir.chdir from Satellite#lock for thread-safety + - Increased default git max_size value from 5MB to 20MB in gitlab.yml. Please update your configs! + - Show error message in case of timeout in satellite when create MR + - Show first 100 files for huge diff instead of hiding all v 7.0.0 - The CPU no longer overheats when you hold down the spacebar diff --git a/Gemfile b/Gemfile index 608c1894a6..2ea83797df 100644 --- a/Gemfile +++ b/Gemfile @@ -174,6 +174,7 @@ gem "font-awesome-rails", '~> 3.2' gem "gitlab_emoji", "~> 0.0.1.1" gem "gon", '~> 5.0.0' gem 'nprogress-rails' +gem 'request_store' group :development do gem "annotate", "~> 2.6.0.beta2" diff --git a/Gemfile.lock b/Gemfile.lock index c589aa6346..7f3c4c6a63 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -165,7 +165,7 @@ GEM multi_json gitlab-grack (2.0.0.pre) rack (~> 1.5.1) - gitlab-grit (2.6.9) + gitlab-grit (2.6.10) charlock_holmes (~> 0.6) diff-lcs (~> 1.1) mime-types (~> 1.15) @@ -409,6 +409,7 @@ GEM redis-store (1.1.4) redis (>= 2.2) ref (1.0.5) + request_store (1.0.5) require_all (1.3.2) rest-client (1.6.7) mime-types (>= 1.16) @@ -648,6 +649,7 @@ DEPENDENCIES rb-inotify redcarpet (~> 2.2.2) redis-rails + request_store rspec-rails sanitize (~> 2.0) sass-rails (~> 4.0.2) diff --git a/app/assets/images/brand_logo.png b/app/assets/images/brand_logo.png index da459c1ec8..09b1689ca4 100644 Binary files a/app/assets/images/brand_logo.png and b/app/assets/images/brand_logo.png differ diff --git a/app/assets/stylesheets/generic/common.scss b/app/assets/stylesheets/generic/common.scss index 31886a5a82..6b285d66f7 100644 --- a/app/assets/stylesheets/generic/common.scss +++ b/app/assets/stylesheets/generic/common.scss @@ -346,3 +346,7 @@ table { .wiki .highlight, .note-body .highlight { margin-bottom: 9px; } + +.footer-links a { + margin-right: 15px; +} diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss index 9b14839011..684e8377a7 100644 --- a/app/assets/stylesheets/sections/commits.scss +++ b/app/assets/stylesheets/sections/commits.scss @@ -112,7 +112,9 @@ .commit-stat-summary { color: #666; - line-height: 2; + font-size: 14px; + font-weight: normal; + padding: 10px 0; } .commit-info-row { diff --git a/app/assets/stylesheets/sections/login.scss b/app/assets/stylesheets/sections/login.scss index 61e2795b33..54887b7c40 100644 --- a/app/assets/stylesheets/sections/login.scss +++ b/app/assets/stylesheets/sections/login.scss @@ -5,18 +5,13 @@ font-weight: 200; } - .login-box { - position: relative; - margin: auto; - padding: 20px; - background: #f5f5f5; - border: 1px solid #EEE; + .login-box{ } .brand-image { - margin-bottom: 20px; img { - max-width: 100%; + max-width: 100%; + margin-bottom: 20px; } } @@ -26,7 +21,7 @@ } .form-control { - background-color: #FFF; + background-color: #F5F5F5; font-size: 16px; padding: 14px 10px; width: 100%; @@ -48,6 +43,10 @@ margin-bottom:0px; @include border-radius(0); } + + &:active, &:focus { + background-color: #FFF; + } } .login-box a.forgot { diff --git a/app/assets/stylesheets/sections/projects.scss b/app/assets/stylesheets/sections/projects.scss index 34dd3448f5..c9188fb751 100644 --- a/app/assets/stylesheets/sections/projects.scss +++ b/app/assets/stylesheets/sections/projects.scss @@ -172,8 +172,8 @@ ul.nav.nav-projects-tabs { } .public-clone { - background: #333; - color: #f5f5f5; + background: #EEE; + color: #777; padding: 6px 10px; margin: 1px; font-weight: normal; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6090c88534..9c1f39c51f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -68,7 +68,7 @@ class ApplicationController < ActionController::Base flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it." new_user_session_path else - @return_to || root_path + stored_location_for(:redirect) || stored_location_for(resource) || root_path end end diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index 860ab40829..c344297ba8 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -20,11 +20,10 @@ class Projects::CommitController < Projects::ApplicationController end begin - @suppress_diff = true if commit.diff_suppress? && !params[:force_show_diff] - @force_suppress_diff = commit.diff_force_suppress? + @diffs = @commit.diffs rescue Grit::Git::GitTimeout - @suppress_diff = true - @status = :huge_commit + @diffs = [] + @diff_timeout = true end @note = project.build_commit_note(commit) @@ -38,12 +37,7 @@ class Projects::CommitController < Projects::ApplicationController } respond_to do |format| - format.html do - if @status == :huge_commit - render "huge_commit" and return - end - end - + format.html format.diff { render text: @commit.to_diff } format.patch { render text: @commit.to_patch } end diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 234b6058ff..eae9639657 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -15,11 +15,7 @@ class Projects::CompareController < Projects::ApplicationController @diffs = compare.diffs @refs_are_same = compare.same @line_notes = [] - @timeout = compare.timeout - - diff_line_count = Commit::diff_line_count(@diffs) - @suppress_diff = Commit::diff_suppress?(@diffs, diff_line_count) && !params[:force_show_diff] - @force_suppress_diff = Commit::diff_force_suppress?(@diffs, diff_line_count) + @diff_timeout = compare.timeout end def create diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index f47ea5625f..fcc6384e27 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -34,6 +34,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController def show @note_counts = Note.where(commit_id: @merge_request.commits.map(&:id)). group(:commit_id).count + respond_to do |format| format.html format.diff { render text: @merge_request.to_diff(current_user) } @@ -43,16 +44,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController def diffs @commit = @merge_request.last_commit - @comments_allowed = @reply_allowed = true - @comments_target = {noteable_type: 'MergeRequest', - noteable_id: @merge_request.id} + @comments_target = { + noteable_type: 'MergeRequest', + noteable_id: @merge_request.id + } @line_notes = @merge_request.notes.where("line_code is not null") - diff_line_count = Commit::diff_line_count(@merge_request.diffs) - @suppress_diff = Commit::diff_suppress?(@merge_request.diffs, diff_line_count) && !params[:force_show_diff] - @force_suppress_diff = Commit::diff_force_suppress?(@merge_request.diffs, diff_line_count) - respond_to do |format| format.html format.json { render json: { html: view_to_html_string("projects/merge_requests/show/_diffs") } } @@ -60,51 +58,22 @@ class Projects::MergeRequestsController < Projects::ApplicationController end def new - params[:merge_request] ||= ActionController::Parameters.new( - source_project: @project - ) + params[:merge_request] ||= ActionController::Parameters.new(source_project: @project) + @merge_request = MergeRequests::BuildService.new(project, current_user, merge_request_params).execute - @merge_request = MergeRequest.new(merge_request_params) - @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 + @target_branches = if @merge_request.target_project + @merge_request.target_project.repository.branch_names + else + [] + end - 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 - ) - - @compare_failed = false - @commits = compare_action.commits - - if @commits - @commits.map! { |commit| Commit.new(commit) } - @commit = @commits.first - else - # false value because failed to get commits from satellite - @commits = [] - @compare_failed = true - end - - @note_counts = Note.where(commit_id: @commits.map(&:id)). - group(:commit_id).count - - @diffs = compare_action.diffs - @merge_request.title = @merge_request.source_branch.titleize.humanize - @merge_request.description = @merge_request.target_project.merge_requests_template - @target_project = @merge_request.target_project - @target_repo = @target_project.repository - - diff_line_count = Commit::diff_line_count(@diffs) - @suppress_diff = Commit::diff_suppress?(@diffs, diff_line_count) - @force_suppress_diff = @suppress_diff - end + @target_project = merge_request.target_project + @source_project = merge_request.source_project + @commits = @merge_request.compare_commits + @commit = @merge_request.compare_base_commit + @diffs = @merge_request.compare_diffs + @note_counts = Note.where(commit_id: @commits.map(&:id)). + group(:commit_id).count end def edit diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 0000000000..9b7bd94c3a --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,14 @@ +class SessionsController < Devise::SessionsController + + def new + if request.referer.present? + store_location_for(:redirect, URI(request.referer).path) + end + + super + end + + def create + super + end +end diff --git a/app/controllers/users_sessions_controller.rb b/app/controllers/users_sessions_controller.rb deleted file mode 100644 index 656c92376f..0000000000 --- a/app/controllers/users_sessions_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class UsersSessionsController < Devise::SessionsController - def create - @return_to = params[:return_to] - super - end -end diff --git a/app/helpers/appearances_helper.rb b/app/helpers/appearances_helper.rb index 6c8ba7936d..fef4d7c035 100644 --- a/app/helpers/appearances_helper.rb +++ b/app/helpers/appearances_helper.rb @@ -8,37 +8,15 @@ module AppearancesHelper end def brand_image - if brand_item - if brand_item.logo? - image_tag brand_item.logo - else - nil - end + if brand_item.logo? + image_tag brand_item.logo else - image_tag 'brand_logo.png' + nil end end def brand_text - default_text =< DIFF_SAFE_FILES - - line_count ||= Commit::diff_line_count(diffs) - line_count > DIFF_SAFE_LINES - end - - def diff_force_suppress?(diffs, line_count = nil) - # optimize - check file count first - return true if diffs.size > DIFF_HARD_LIMIT_FILES - - line_count ||= Commit::diff_line_count(diffs) - line_count > DIFF_HARD_LIMIT_LINES + diffs.reduce(0) { |sum, d| sum + d.diff.lines.count } end end @@ -60,14 +45,6 @@ class Commit @diff_line_count end - def diff_suppress? - Commit::diff_suppress?(self.diffs, diff_line_count) - end - - def diff_force_suppress? - Commit::diff_force_suppress?(self.diffs, diff_line_count) - end - # Returns a string describing the commit for use in a link title # # Example diff --git a/app/models/group_milestone.rb b/app/models/group_milestone.rb index 013f8db00a..3391531378 100644 --- a/app/models/group_milestone.rb +++ b/app/models/group_milestone.rb @@ -50,10 +50,10 @@ class GroupMilestone def state state = milestones.map { |milestone| milestone.state } - if state.count('active') == state.size - 'active' - else + if state.count('closed') == state.size 'closed' + else + 'active' end end diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 597e02d498..28486fb41c 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -42,6 +42,11 @@ class MergeRequest < ActiveRecord::Base # It allows us to close or modify broken merge requests attr_accessor :allow_broken + # Temporary fields to store compare vars + # when creating new merge request + attr_accessor :can_be_created, :compare_failed, :compare_base_commit, + :compare_commits, :compare_diffs + ActsAsTaggableOn.strict_case_match = true acts_as_taggable_on :labels diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb new file mode 100644 index 0000000000..1cd8c1039e --- /dev/null +++ b/app/services/merge_requests/build_service.rb @@ -0,0 +1,73 @@ +module MergeRequests + class BuildService < MergeRequests::BaseService + def execute + merge_request = MergeRequest.new(params) + + # Set MR attributes + merge_request.can_be_created = false + merge_request.compare_failed = false + merge_request.compare_commits = [] + merge_request.compare_diffs = [] + merge_request.source_project = project unless merge_request.source_project + merge_request.target_project ||= (project.forked_from_project || project) + merge_request.target_branch ||= merge_request.target_project.default_branch + + unless merge_request.target_branch && merge_request.source_branch + return build_failed(merge_request, "You must select source and target branches") + end + + # Generate suggested MR title based on source branch name + merge_request.title = merge_request.source_branch.titleize.humanize + + # Set MR description based on project template + merge_request.description = merge_request.target_project.merge_requests_template + + # Try to compare branches to get commits list and diffs + 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 + + # At this point we decide if merge request can be created + # If we have at least one commit to merge -> creation allowed + if commits.present? + merge_request.compare_commits = Commit.decorate(commits) + merge_request.compare_base_commit = Commit.new(commits.first) + merge_request.can_be_created = true + merge_request.compare_failed = false + + # Try to collect diff for merge request. + diffs = compare_action.diffs + + if diffs.present? + merge_request.compare_diffs = diffs + + elsif diffs == false + # satellite timeout return false + merge_request.can_be_created = false + merge_request.compare_failed = true + end + else + merge_request.can_be_created = false + merge_request.compare_failed = false + end + + merge_request + + rescue Gitlab::Satellite::BranchesWithoutParent + return build_failed(merge_request, "Selected branches have no common commit so they cannot be merged.") + end + + def build_failed(merge_request, message) + merge_request.errors.add(:base, message) + merge_request.compare_commits = [] + merge_request.can_be_created = false + merge_request + end + end +end diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml index bf634d9de6..08e1749086 100755 --- a/app/views/devise/confirmations/new.html.haml +++ b/app/views/devise/confirmations/new.html.haml @@ -1,15 +1,13 @@ -.login-box - %h3.page-title Resend confirmation instructions - = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| - .devise-errors - = devise_error_messages! - .clearfix.append-bottom-20 - = f.email_field :email, placeholder: 'Email', class: "form-control", required: true - .clearfix.append-bottom-10 - = f.submit "Resend confirmation instructions", class: 'btn btn-success' - %hr - %p - %span.light - Already have login and password? - %strong - = link_to "Sign in", new_session_path(resource_name) +.login-box.panel.panel-default + .panel-heading + %h3.panel-title Resend confirmation instructions + .panel-body + = form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| + .devise-errors + = devise_error_messages! + .clearfix.append-bottom-20 + = f.email_field :email, placeholder: 'Email', class: "form-control", required: true + .clearfix.append-bottom-10 + = f.submit "Resend confirmation instructions", class: 'btn btn-success' + .panel-footer + = render 'devise/shared/sign_in_link' diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index 95c52608e1..efcd029617 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -1,15 +1,18 @@ -= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: "login-box" }) do |f| - %h3 Change your password - .devise-errors - = devise_error_messages! - = f.hidden_field :reset_password_token - %div - = f.password_field :password, class: "form-control top", placeholder: "New password", required: true - %div - = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm new password", required: true - %div - .clearfix.append-bottom-10 - = f.submit "Change my password", class: "btn btn-primary" - = link_to "Sign in", new_session_path(resource_name), class: "btn pull-right" - %div - = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) +.login-box.panel.panel-default + .panel-heading + %h3.panel-title Change your password + .panel-body + = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| + .devise-errors + = devise_error_messages! + = f.hidden_field :reset_password_token + %div + = f.password_field :password, class: "form-control top", placeholder: "New password", required: true + %div + = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm new password", required: true + .clearfix.append-bottom-10 + = f.submit "Change my password", class: "btn btn-primary" + .panel-footer + %p + = link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) + = render 'devise/shared/sign_in_link' diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index 040821ca32..bf44dee5ad 100755 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -1,14 +1,13 @@ -= form_for(resource, as: resource_name, url: password_path(resource_name), html: { class: "login-box", method: :post }) do |f| - %h3.page-title Reset password - .devise-errors - = devise_error_messages! - .clearfix.append-bottom-20 - = f.email_field :email, placeholder: "Email", class: "form-control", required: true - .clearfix.append-bottom-10 - = f.submit "Reset password", class: "btn-primary btn" - %hr - %p - %span.light - Already have login and password? - %strong - = link_to "Sign in", new_session_path(resource_name) +.login-box.panel.panel-default + .panel-heading + %h3.panel-title Reset password + .panel-body + = form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| + .devise-errors + = devise_error_messages! + .clearfix.append-bottom-20 + = f.email_field :email, placeholder: "Email", class: "form-control", required: true + .clearfix.append-bottom-10 + = f.submit "Reset password", class: "btn-primary btn" + .panel-footer + = render 'devise/shared/sign_in_link' diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 24bc040654..52d484949b 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -1,24 +1,27 @@ -= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: "login-box" }) do |f| - %h3.page-title Sign Up - .devise-errors - = devise_error_messages! - %div - = f.text_field :name, class: "form-control top", placeholder: "Name", required: true - %div - = f.text_field :username, class: "form-control middle", placeholder: "Username", required: true - %div - = f.email_field :email, class: "form-control middle", placeholder: "Email", required: true - %div - = f.password_field :password, class: "form-control middle", placeholder: "Password", required: true - %div - = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm password", required: true - %div - = f.submit "Sign up", class: "btn-create btn" - %hr - %p - %span.light - Have an account? - %strong - = link_to "Sign in", new_session_path(resource_name) - %p - = link_to "Forgot your password?", new_password_path(resource_name) +.login-box.panel.panel-success + .panel-heading + %h3.panel-title Sign up + .panel-body + = form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| + .devise-errors + = devise_error_messages! + %div + = f.text_field :name, class: "form-control top", placeholder: "Name", required: true + %div + = f.text_field :username, class: "form-control middle", placeholder: "Username", required: true + %div + = f.email_field :email, class: "form-control middle", placeholder: "Email", required: true + %div + = f.password_field :password, class: "form-control middle", placeholder: "Password", required: true + %div + = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm password", required: true + %div + = f.submit "Sign up", class: "btn-create btn" + .panel-footer + %p + %span.light + Have an account? + %strong + = link_to "Sign in", new_session_path(resource_name) + %p + = link_to "Forgot your password?", new_password_path(resource_name) diff --git a/app/views/devise/sessions/_new_base.html.haml b/app/views/devise/sessions/_new_base.html.haml index 989fcb4a63..4e19604489 100644 --- a/app/views/devise/sessions/_new_base.html.haml +++ b/app/views/devise/sessions/_new_base.html.haml @@ -7,8 +7,6 @@ = f.check_box :remember_me %span Remember me %div - = hidden_field_tag 'return_to', params[:return_to] - = f.submit "Sign in", class: "btn-create btn" - + = f.submit "Sign in", class: "btn-save btn" .pull-right = link_to "Forgot your password?", new_password_path(resource_name), class: "btn" diff --git a/app/views/devise/sessions/_new_ldap.html.haml b/app/views/devise/sessions/_new_ldap.html.haml index bb1d0a4001..6c5a878e90 100644 --- a/app/views/devise/sessions/_new_ldap.html.haml +++ b/app/views/devise/sessions/_new_ldap.html.haml @@ -2,4 +2,4 @@ = text_field_tag :username, nil, {class: "form-control top", placeholder: "LDAP Login", autofocus: "autofocus"} = password_field_tag :password, nil, {class: "form-control bottom", placeholder: "Password"} %br/ - = submit_tag "LDAP Sign in", class: "btn-create btn" + = submit_tag "LDAP Sign in", class: "btn-save btn" diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 31221ae9c3..f53d6f09da 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -1,43 +1,42 @@ -.login-box - %h3.page-title Sign in - - if ldap_enabled? && gitlab_config.signin_enabled - %ul.nav.nav-tabs - %li.active - = link_to 'LDAP', '#tab-ldap', 'data-toggle' => 'tab' - %li - = link_to 'Standard', '#tab-signin', 'data-toggle' => 'tab' - .tab-content - %div#tab-ldap.tab-pane.active - = render partial: 'devise/sessions/new_ldap' - %div#tab-signin.tab-pane - = render partial: 'devise/sessions/new_base' +.login-box.panel.panel-primary + .panel-heading + %h3.panel-title Sign in + .panel-body + - if ldap_enabled? && gitlab_config.signin_enabled + %ul.nav.nav-tabs + %li.active + = link_to 'LDAP', '#tab-ldap', 'data-toggle' => 'tab' + %li + = link_to 'Standard', '#tab-signin', 'data-toggle' => 'tab' + .tab-content + %div#tab-ldap.tab-pane.active + = render partial: 'devise/sessions/new_ldap' + %div#tab-signin.tab-pane + = render partial: 'devise/sessions/new_base' - - elsif ldap_enabled? - = render partial: 'devise/sessions/new_ldap' + - elsif ldap_enabled? + = render partial: 'devise/sessions/new_ldap' + - elsif gitlab_config.signin_enabled + = render partial: 'devise/sessions/new_base' + - else + %div + No authentication methods configured. - - elsif gitlab_config.signin_enabled - = render partial: 'devise/sessions/new_base' + = render 'devise/sessions/oauth_providers' if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable? - - else - %div - No authentication methods configured. + .panel-footer + - if gitlab_config.signup_enabled + %p + %span.light + Don't have an account? + %strong + = link_to "Sign up", new_registration_path(resource_name) - - = render 'devise/sessions/oauth_providers' if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable? - %hr - - - if gitlab_config.signup_enabled %p - %span.light - Don't have an account? - %strong - = link_to "Sign up", new_registration_path(resource_name) - - %p - %span.light Did not receive confirmation email? - = link_to "Send again", new_confirmation_path(resource_name) + %span.light Did not receive confirmation email? + = link_to "Send again", new_confirmation_path(resource_name) - - if extra_config.has_key?('sign_in_text') - %hr - = markdown(extra_config.sign_in_text) + - if extra_config.has_key?('sign_in_text') + %hr + = markdown(extra_config.sign_in_text) diff --git a/app/views/devise/shared/_sign_in_link.html.haml b/app/views/devise/shared/_sign_in_link.html.haml new file mode 100644 index 0000000000..fafc4b82f5 --- /dev/null +++ b/app/views/devise/shared/_sign_in_link.html.haml @@ -0,0 +1,5 @@ +%p + %span.light + Already have login and password? + %strong + = link_to "Sign in", new_session_path(resource_name) diff --git a/app/views/groups/milestones/show.html.haml b/app/views/groups/milestones/show.html.haml index 29b274af5a..411d1822be 100644 --- a/app/views/groups/milestones/show.html.haml +++ b/app/views/groups/milestones/show.html.haml @@ -32,11 +32,11 @@ %h4 = link_to "#{milestone.project.name} - #{milestone.title}", project_milestone_path(milestone.project, milestone) %span.pull-right= milestone.expires_at + - if milestone.closed? + %span.label.label-danger #{milestone.state} = preserve do - if milestone.description.present? = milestone.description - - else - %em Project milestone has no description .context %p diff --git a/app/views/layouts/_public_head_panel.html.haml b/app/views/layouts/_public_head_panel.html.haml index 25984df044..63992a22f3 100644 --- a/app/views/layouts/_public_head_panel.html.haml +++ b/app/views/layouts/_public_head_panel.html.haml @@ -13,10 +13,10 @@ %i.icon-reorder .pull-right.hidden-xs - = link_to "Sign in", new_session_path(:user, return_to: request.fullpath), class: 'btn btn-sign-in btn-new' + = link_to "Sign in", new_session_path(:user), class: 'btn btn-sign-in btn-new' .navbar-collapse.collapse %ul.nav.navbar-nav %li.visible-xs - = link_to "Sign in", new_session_path(:user, return_to: request.fullpath) + = link_to "Sign in", new_session_path(:user) diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml index 2ae27c4b79..ff27fcc0f4 100644 --- a/app/views/layouts/devise.html.haml +++ b/app/views/layouts/devise.html.haml @@ -11,10 +11,28 @@ .container .content .row - .col-sm-7 - .brand-image - = brand_image - .brand_text - = brand_text - .col-sm-5 + .col-md-7 + - if brand_item + .brand-image + = brand_image + .brand_text + = brand_text + - else + .brand-image.hidden-sm.hidden-xs + = image_tag 'brand_logo.png' + .brand_text.hidden-xs + %h2 Open source software to collaborate on code + + %p.lead + Manage git repositories with fine grained access controls that keep your code secure. + Perform code reviews and enhance collaboration with merge requests. + Each project can also have an issue tracker and a wiki. + + .col-md-5 = yield + %hr + .container + .footer-links + = link_to "Explore public projects", public_projects_path + = link_to "Documentation", "http://doc.gitlab.com/" + = link_to "About GitLab", "https://about.gitlab.com/" diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml index 2a97cb4903..ddf815ebd9 100644 --- a/app/views/projects/_home_panel.html.haml +++ b/app/views/projects/_home_panel.html.haml @@ -17,7 +17,7 @@ .col-md-7 .project-home-desc - if @project.description.present? - = auto_link @project.description, link: :urls + = auto_link ERB::Util.html_escape(@project.description), link: :urls - if can?(current_user, :admin_project, @project) – %strong= link_to 'Edit', edit_project_path diff --git a/app/views/projects/commit/huge_commit.html.haml b/app/views/projects/commit/huge_commit.html.haml deleted file mode 100644 index 398ce77142..0000000000 --- a/app/views/projects/commit/huge_commit.html.haml +++ /dev/null @@ -1,3 +0,0 @@ -= render "projects/commit/commit_box" -.alert.alert-danger - %h4 Commit diffs are too big to be displayed diff --git a/app/views/projects/commit/show.html.haml b/app/views/projects/commit/show.html.haml index da1b4c10f8..0a15aef6cb 100644 --- a/app/views/projects/commit/show.html.haml +++ b/app/views/projects/commit/show.html.haml @@ -1,3 +1,3 @@ = render "commit_box" -= render "projects/commits/diffs", diffs: @commit.diffs, project: @project += render "projects/commits/diffs", diffs: @diffs, project: @project = render "projects/notes/notes_with_form" diff --git a/app/views/projects/commits/_diff_file.html.haml b/app/views/projects/commits/_diff_file.html.haml new file mode 100644 index 0000000000..45d1cd9c9a --- /dev/null +++ b/app/views/projects/commits/_diff_file.html.haml @@ -0,0 +1,48 @@ +- file = project.repository.blob_at(@commit.id, diff.new_path) +- file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file +- return unless file +.diff-file{id: "diff-#{i}"} + .diff-header{id: "file-path-#{hexdigest(diff.new_path || diff.old_path)}"} + - if diff.deleted_file + %span= diff.old_path + + .diff-btn-group + - if @commit.parent_ids.present? + = link_to project_blob_path(project, tree_join(@commit.parent_id, diff.new_path)), { class: 'btn btn-small view-file' } do + View file @ + %span.commit-short-id= @commit.short_id(6) + - else + %span= diff.new_path + - if diff_file_mode_changed?(diff) + %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" + + .diff-btn-group + = link_to "#", class: "js-toggle-diff-comments btn btn-small" do + %i.icon-chevron-down + Diff comments +   + + - if @merge_request && @merge_request.source_project + = link_to project_edit_tree_path(@merge_request.source_project, tree_join(@merge_request.source_branch, diff.new_path), from_merge_request_id: @merge_request.id), { class: 'btn btn-small' } do + Edit +   + + = link_to project_blob_path(project, tree_join(@commit.id, diff.new_path)), { class: 'btn btn-small view-file' } do + View file @ + %span.commit-short-id= @commit.short_id(6) + + + .diff-content + -# Skipp all non non-supported blobs + - return unless file.respond_to?('text?') + - if file.text? + - if params[:view] == 'parallel' + = render "projects/commits/parallel_view", diff: diff, project: project, file: file, index: i + - else + = render "projects/commits/text_file", diff: diff, index: i + - elsif file.image? + - old_file = project.repository.blob_at(@commit.parent_id, diff.old_path) if @commit.parent_id + = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i + - else + .nothing-here-block No preview for this file type + diff --git a/app/views/projects/commits/_diff_head.html.haml b/app/views/projects/commits/_diff_head.html.haml deleted file mode 100644 index 5aa542287f..0000000000 --- a/app/views/projects/commits/_diff_head.html.haml +++ /dev/null @@ -1,26 +0,0 @@ -%ul.bordered-list - - diffs.each_with_index do |diff, i| - %li - - if diff.deleted_file - %span.deleted-file - %a{href: "#diff-#{i}"} - %i.icon-minus - = diff.old_path - - elsif diff.renamed_file - %span.renamed-file - %a{href: "#diff-#{i}"} - %i.icon-minus - = diff.old_path - = "->" - = diff.new_path - - elsif diff.new_file - %span.new-file - %a{href: "#diff-#{i}"} - %i.icon-plus - = diff.new_path - - else - %span.edit-file - %a{href: "#diff-#{i}"} - %i.icon-adjust - = diff.new_path - diff --git a/app/views/projects/commits/_diff_stats.html.haml b/app/views/projects/commits/_diff_stats.html.haml new file mode 100644 index 0000000000..846a1ee10e --- /dev/null +++ b/app/views/projects/commits/_diff_stats.html.haml @@ -0,0 +1,41 @@ +.js-toggle-container + .commit-stat-summary + Showing + %strong.cdark #{pluralize(diffs.count, "changed file")} + - if current_controller?(:commit) + - unless @commit.has_zero_stats? + with + %strong.cgreen #{@commit.stats.additions} additions + and + %strong.cred #{@commit.stats.deletions} deletions +   + = link_to '#', class: 'btn btn-small js-toggle-button' do + Show diff stats + %i.icon-chevron-down + .file-stats.js-toggle-content.hide + %ul.bordered-list + - diffs.each_with_index do |diff, i| + %li + - if diff.deleted_file + %span.deleted-file + %a{href: "#diff-#{i}"} + %i.icon-minus + = diff.old_path + - elsif diff.renamed_file + %span.renamed-file + %a{href: "#diff-#{i}"} + %i.icon-minus + = diff.old_path + = "->" + = diff.new_path + - elsif diff.new_file + %span.new-file + %a{href: "#diff-#{i}"} + %i.icon-plus + = diff.new_path + - else + %span.edit-file + %a{href: "#diff-#{i}"} + %i.icon-adjust + = diff.new_path + diff --git a/app/views/projects/commits/_diff_warning.html.haml b/app/views/projects/commits/_diff_warning.html.haml new file mode 100644 index 0000000000..05d516efa1 --- /dev/null +++ b/app/views/projects/commits/_diff_warning.html.haml @@ -0,0 +1,19 @@ +.bs-callout.bs-callout-warning + %h4 + Too many changes. + .pull-right + - unless diff_hard_limit_enabled? + = link_to "Reload with full diff", url_for(params.merge(force_show_diff: true)), class: "btn btn-small btn-warning" + + - if current_controller?(:commit) or current_controller?(:merge_requests) + - if current_controller?(:commit) + = link_to "Plain diff", project_commit_path(@project, @commit, format: :diff), class: "btn btn-warning btn-small" + = link_to "Email patch", project_commit_path(@project, @commit, format: :patch), class: "btn btn-warning btn-small" + - elsif @merge_request && @merge_request.persisted? + = link_to "Plain diff", project_merge_request_path(@project, @merge_request, format: :diff), class: "btn btn-warning btn-small" + = link_to "Email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "btn btn-warning btn-small" + %p + To preserve performance only + %strong #{safe_diff_files(diffs).size} of #{diffs.size} + files displayed. + diff --git a/app/views/projects/commits/_diffs.html.haml b/app/views/projects/commits/_diffs.html.haml index fcdb40468d..64d6a2f09c 100644 --- a/app/views/projects/commits/_diffs.html.haml +++ b/app/views/projects/commits/_diffs.html.haml @@ -1,91 +1,23 @@ -- @suppress_diff ||= @suppress_diff || @force_suppress_diff -- if @suppress_diff - .alert.alert-warning - %p - %strong Warning! This is a large diff. - %p - To preserve performance the diff is not shown. - - if current_controller?(:commit) or current_controller?(:merge_requests) - - if current_controller?(:commit) - Please, download the diff as - = link_to "plain diff", project_commit_path(@project, @commit, format: :diff), class: "underlined-link" - or - = link_to "email patch", project_commit_path(@project, @commit, format: :patch), class: "underlined-link" - instead. - - elsif @merge_request && @merge_request.persisted? - Please, download the diff as - = link_to "plain diff", project_merge_request_path(@project, @merge_request, format: :diff), class: "underlined-link" - or - = link_to "email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "underlined-link" - instead. - - unless @force_suppress_diff - %p - If you still want to see the diff - = link_to "click this link", url_for(force_show_diff: true), class: "underlined-link" +.row + .col-md-8 + = render 'projects/commits/diff_stats', diffs: diffs + .col-md-4 + %ul.nav.nav-tabs + %li.pull-right{class: params[:view] == 'parallel' ? 'active' : ''} + = link_to "Side-by-side Diff", url_for(view: 'parallel'), {id: "commit-diff-viewtype"} + %li.pull-right{class: params[:view] != 'parallel' ? 'active' : ''} + = link_to "Inline Diff", url_for(view: 'inline'), {id: "commit-diff-viewtype"} -%p.commit-stat-summary - Showing - %strong.cdark #{pluralize(diffs.count, "changed file")} - - if current_controller?(:commit) - - unless @commit.has_zero_stats? - with - %strong.cgreen #{@commit.stats.additions} additions - and - %strong.cred #{@commit.stats.deletions} deletions - - if params[:view] == 'parallel' - = link_to "Inline Diff", url_for(view: 'inline'), {id: "commit-diff-viewtype", class: 'btn btn-tiny pull-right'} - - else - = link_to "Side-by-side Diff", url_for(view: 'parallel'), {id: "commit-diff-viewtype", class: 'btn btn-tiny pull-right'} -.file-stats - = render "projects/commits/diff_head", diffs: diffs +- if show_diff_size_warninig?(diffs) + = render 'projects/commits/diff_warning', diffs: diffs .files - - unless @suppress_diff - - diffs.each_with_index do |diff, i| - - file = project.repository.blob_at(@commit.id, diff.new_path) - - file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file - - next unless file - .diff-file{id: "diff-#{i}"} - .diff-header{id: "file-path-#{hexdigest(diff.new_path || diff.old_path)}"} - - if diff.deleted_file - %span= diff.old_path + - safe_diff_files(diffs).each_with_index do |diff, i| + = render 'projects/commits/diff_file', diff: diff, i: i, project: project - .diff-btn-group - - if @commit.parent_ids.present? - = link_to project_blob_path(project, tree_join(@commit.parent_id, diff.new_path)), { class: 'btn btn-small view-file' } do - View file @ - %span.commit-short-id= @commit.short_id(6) - - else - %span= diff.new_path - - if diff_file_mode_changed?(diff) - %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}" - - .diff-btn-group - = link_to "#", class: "js-toggle-diff-comments btn btn-small" do - %i.icon-chevron-down - Diff comments -   - - - if @merge_request && @merge_request.source_project - = link_to project_edit_tree_path(@merge_request.source_project, tree_join(@merge_request.source_branch, diff.new_path), from_merge_request_id: @merge_request.id), { class: 'btn btn-small' } do - Edit -   - - = link_to project_blob_path(project, tree_join(@commit.id, diff.new_path)), { class: 'btn btn-small view-file' } do - View file @ - %span.commit-short-id= @commit.short_id(6) - - - .diff-content - -# Skipp all non non-supported blobs - - next unless file.respond_to?('text?') - - if file.text? - - if params[:view] == 'parallel' - = render "projects/commits/parallel_view", diff: diff, project: project, file: file, index: i - - else - = render "projects/commits/text_file", diff: diff, index: i - - elsif file.image? - - old_file = project.repository.blob_at(@commit.parent_id, diff.old_path) if @commit.parent_id - = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i - - else - .nothing-here-block No preview for this file type +- if @diff_timeout + .alert.alert-danger + %h4 + Failed to collect changes + %p + Maybe diff is really big and operation failed with timeout. Try to get diff localy diff --git a/app/views/projects/commits/_text_file.html.haml b/app/views/projects/commits/_text_file.html.haml index 8ced413329..f5b0d71141 100644 --- a/app/views/projects/commits/_text_file.html.haml +++ b/app/views/projects/commits/_text_file.html.haml @@ -1,4 +1,4 @@ -- too_big = diff.diff.lines.count > 1000 +- too_big = diff.diff.lines.count > Commit::DIFF_SAFE_LINES - if too_big %a.supp_diff_link Changes suppressed. Click to show diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml index b232d2a6b2..240bfe7484 100644 --- a/app/views/projects/compare/show.html.haml +++ b/app/views/projects/compare/show.html.haml @@ -18,18 +18,7 @@ - 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. - - elsif @timeout - .bs-callout.bs-callout-danger - %h4 Number of changed files for this comparison is extremely large. - %p Use command line to browse through changes for this comparison. - + = render "projects/commits/diffs", diffs: @diffs, project: @project - else .light-well diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml index 18e3f419c7..9972617215 100644 --- a/app/views/projects/merge_requests/_new_compare.html.haml +++ b/app/views/projects/merge_requests/_new_compare.html.haml @@ -27,13 +27,13 @@ .panel-footer .mr_target_commit - -if @merge_request.errors.any? + - 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? - - if @compare_failed + - elsif @merge_request.source_branch.present? && @merge_request.target_branch.present? + - if @merge_request.compare_failed .alert.alert-danger %h4 Compare failed %p We can't compare selected branches. It may be because of huge diff or satellite timeout. Please try again or select different branches. diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index 34a30975e0..73d364b4f9 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -44,11 +44,10 @@ 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)) + - if contribution_guide_url(@target_project) %p Please review the - %strong #{link_to "guidelines for contribution", contribution_guide_url} + %strong #{link_to "guidelines for contribution", contribution_guide_url(@target_project)} to this repository. = f.hidden_field :source_project_id = f.hidden_field :target_project_id @@ -76,6 +75,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. + - else + .bs-callout.bs-callout-danger + %h4 This comparison includes huge diff. + %p To preserve performance the line changes are not shown. :javascript diff --git a/app/views/projects/merge_requests/new.html.haml b/app/views/projects/merge_requests/new.html.haml index c24e591672..4756903d0e 100644 --- a/app/views/projects/merge_requests/new.html.haml +++ b/app/views/projects/merge_requests/new.html.haml @@ -1,4 +1,4 @@ -- if @commits.present? +- if @merge_request.can_be_created = render 'new_submit' - else = render 'new_compare' diff --git a/app/views/public/projects/index.html.haml b/app/views/public/projects/index.html.haml index 624ec0b9b9..7d4d94ce42 100644 --- a/app/views/public/projects/index.html.haml +++ b/app/views/public/projects/index.html.haml @@ -45,7 +45,7 @@ %small.access-icon = internal_icon Internal - .pull-right + .pull-right.hidden-sm.hidden-xs %pre.public-clone git clone #{project.http_url_to_repo} - if project.description.present? diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 2bfaa361c4..7e20963e31 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -244,7 +244,7 @@ production: &base # The next value is the maximum memory size grit can use # Given in number of bytes per git object (e.g. a commit) # This value can be increased if you have very large commits - max_size: 5242880 # 5.megabytes + max_size: 20971520 # 20.megabytes # Git timeout to read a commit, in seconds timeout: 10 diff --git a/config/routes.rb b/config/routes.rb index 830f5fd482..d7d80d50db 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -175,7 +175,7 @@ Gitlab::Application.routes.draw do resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create] - devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :users_sessions } + devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :sessions } devise_scope :user do get "/users/auth/:provider/omniauth_error" => "omniauth_callbacks#omniauth_error", as: :omniauth_error diff --git a/doc/api/users.md b/doc/api/users.md index a7e9518408..57078353fd 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -6,7 +6,7 @@ Get a list of users. This function takes pagination parameters `page` and `per_page` to restrict the list of users. -### For normal users: +### For normal users ``` GET /users @@ -31,8 +31,7 @@ GET /users ] ``` - -### For admins: +### For admins ``` GET /users @@ -92,7 +91,7 @@ Also see `def search query` in `app/models/user.rb`. Get a single user. -#### For user: +### For user ``` GET /users/:id @@ -112,8 +111,7 @@ Parameters: } ``` - -#### For admin: +### For admin ``` GET /users/:id @@ -161,13 +159,13 @@ Parameters: - `username` (required) - Username - `name` (required) - Name - `skype` (optional) - Skype ID -- `linkedin` (optional) - Linkedin +- `linkedin` (optional) - LinkedIn - `twitter` (optional) - Twitter account -- `website_url` (optional) - Website url +- `website_url` (optional) - Website URL - `projects_limit` (optional) - Number of projects user can create - `extern_uid` (optional) - External UID - `provider` (optional) - External provider name -- `bio` (optional) - User's bio +- `bio` (optional) - User's biography - `admin` (optional) - User is admin - true or false (default) - `can_create_group` (optional) - User can create groups - true or false @@ -181,26 +179,32 @@ PUT /users/:id Parameters: -- `email` - Email -- `username` - Username -- `name` - Name -- `password` - Password -- `skype` - Skype ID -- `linkedin` - Linkedin -- `twitter` - Twitter account -- `website_url` - Website url -- `projects_limit` - Limit projects each user can create -- `extern_uid` - External UID -- `provider` - External provider name -- `bio` - User's bio -- `admin` (optional) - User is admin - true or false (default) -- `can_create_group` (optional) - User can create groups - true or false +- `email` - Email +- `username` - Username +- `name` - Name +- `password` - Password +- `skype` - Skype ID +- `linkedin` - LinkedIn +- `twitter` - Twitter account +- `website_url` - Website URL +- `projects_limit` - Limit projects each user can create +- `extern_uid` - External UID +- `provider` - External provider name +- `bio` - User's biography +- `admin` (optional) - User is admin - true or false (default) +- `can_create_group` (optional) - User can create groups - true or false -Note, at the moment this method does only return a 404 error, even in cases where a 409 (Conflict) would be more appropriate, e.g. when renaming the email address to some existing one. +Note, at the moment this method does only return a 404 error, +even in cases where a 409 (Conflict) would be more appropriate, +e.g. when renaming the email address to some existing one. ## User deletion -Deletes a user. Available only for administrators. This is an idempotent function, calling this function for a non-existent user id still returns a status code `200 Ok`. The JSON response differs if the user was actually deleted or not. In the former the user is returned and in the latter not. +Deletes a user. Available only for administrators. +This is an idempotent function, calling this function for a non-existent user id +still returns a status code `200 Ok`. +The JSON response differs if the user was actually deleted or not. +In the former the user is returned and in the latter not. ``` DELETE /users/:id @@ -310,7 +314,7 @@ POST /user/keys Parameters: - `title` (required) - new SSH Key's title -- `key` (required) - new SSH key +- `key` (required) - new SSH key ## Add SSH key for user @@ -322,15 +326,17 @@ POST /users/:id/keys Parameters: -- `id` (required) - id of specified user +- `id` (required) - id of specified user - `title` (required) - new SSH Key's title -- `key` (required) - new SSH key +- `key` (required) - new SSH key Will return created key with status `201 Created` on success, or `404 Not found` on fail. ## Delete SSH key for current user -Deletes key owned by currently authenticated user. This is an idempotent function and calling it on a key that is already deleted or not available results in `200 Ok`. +Deletes key owned by currently authenticated user. +This is an idempotent function and calling it on a key that is already deleted +or not available results in `200 Ok`. ``` DELETE /user/keys/:id @@ -351,6 +357,6 @@ DELETE /users/:uid/keys/:id Parameters: - `uid` (required) - id of specified user -- `id` (required) - SSH key ID +- `id` (required) - SSH key ID Will return `200 Ok` on success, or `404 Not found` if either user or key cannot be found. diff --git a/doc/development/gitlab_diagram_overview.odg b/doc/development/gitlab_diagram_overview.odg index b7e02f8fa7..9bfc7313ff 100644 Binary files a/doc/development/gitlab_diagram_overview.odg and b/doc/development/gitlab_diagram_overview.odg differ diff --git a/doc/development/gitlab_diagram_overview.png b/doc/development/gitlab_diagram_overview.png index b5831cf0a4..d9b9eed3d8 100644 Binary files a/doc/development/gitlab_diagram_overview.png and b/doc/development/gitlab_diagram_overview.png differ diff --git a/doc/permissions/permissions.md b/doc/permissions/permissions.md index d1da149652..29fe521b4d 100644 --- a/doc/permissions/permissions.md +++ b/doc/permissions/permissions.md @@ -16,7 +16,6 @@ If a user is a GitLab administrator they receive all permissions. | Pull project code | | ✓ | ✓ | ✓ | ✓ | | Download project | | ✓ | ✓ | ✓ | ✓ | | Create code snippets | | ✓ | ✓ | ✓ | ✓ | -| Create new milestones | | | ✓ | ✓ | ✓ | | Create new merge request | | | ✓ | ✓ | ✓ | | Create new branches | | | ✓ | ✓ | ✓ | | Push to non-protected branches | | | ✓ | ✓ | ✓ | @@ -24,6 +23,7 @@ If a user is a GitLab administrator they receive all permissions. | Add tags | | | ✓ | ✓ | ✓ | | Write a wiki | | | ✓ | ✓ | ✓ | | Manage issue tracker | | | ✓ | ✓ | ✓ | +| Create new milestones | | | | ✓ | ✓ | | Add new team members | | | | ✓ | ✓ | | Push to protected branches | | | | ✓ | ✓ | | Enable/Disable branch protection | | | | ✓ | ✓ | diff --git a/doc/release/monthly.md b/doc/release/monthly.md index 922189a920..1c95a45c92 100644 --- a/doc/release/monthly.md +++ b/doc/release/monthly.md @@ -14,13 +14,47 @@ A release manager is selected that coordinates the entire release of this versio Any changes not yet added to the changelog are added by lead developer and in that merge request the complete team is asked if there is anything missing. -# **18th - Releasing RC1** +### **4. Create an overall issue** + +``` +15th: + +* Update the changelog (#LINK) + +17th: + +* Create x.x.0.rc1 (#LINK) + +18th: + +* Update GitLab.com with rc1 (#LINK) +* Regression issue and tweet about rc1 (#LINK) +* Start blog post (#LINK) + +21th: + +* Do QA and fix anything coming out of it (#LINK) + +22nd: + +* Release CE and EE (#LINK) + +23th: + +* Prepare package for GitLab.com release (#LINK) + +24th: + +* Deploy to GitLab.com (#LINK) +``` + +# **17th - Create RC1** 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. Merge the CE code into EE** -Consider naming the issue "Release x.x.x.rc1" to make it easier for later searches. +Do this via a merge request. ### **2. Update the installation guide** @@ -107,12 +141,22 @@ 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. Update GitLab.com** +# **18th - Release RC1** + +### **1. Update GitLab.com** Merge the RC1 code into GitLab.com. 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. -### **8. Create a regressions issue** +### **2. Prepare the blog post** + +- Check the changelog of CE and EE for important changes. Based on [release blog template](https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/doc/release_blog_template.md) fill in the important information. +- Create a WIP MR for the blog post and cc the team so everyone can give feedback. +- Ask Dmitriy to add screenshots to the WIP MR. +- Decide with team who will be the MVP user. +- 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. + +### **3. Create a regressions issue** On [the GitLab CE issue tracker on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/issues/) create an issue titled "GitLab X.X regressions" add the following text: @@ -123,23 +167,15 @@ The release manager will comment here about the plans for patch releases. Assign the issue to the release manager and /cc all the core-team members active on the issue tracker. If there are any known bugs in the release add them immediately. -### **9. Tweet** +### **4. Tweet** Tweet about the RC release: -> GitLab x.x.x.rc1 is out. This release candidate is only suitable for testing. Please create issues for regressions and add a link from LINK_TO_ISSUE. +> GitLab x.x.0.rc1 is out. This release candidate is only suitable for testing. Please create issues for regressions and add a link from LINK_TO_ISSUE. # **21st - Preparation ** -### **1. Prepare the blog post** - -- Check the changelog of CE and EE for important changes. Based on [release blog template](https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/doc/release_blog_template.md) fill in the important information. -- Create a WIP MR for the blog post and cc the team so everyone can give feedback. -- Ask Dmitriy to add screenshots to the WIP MR. -- Decide with team who will be the MVP user. -- 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. - -### **2. Q&A** +### **1. Q&A** Create issue on dev.gitlab.org `gitlab` repository, named "GitLab X.X release" in order to keep track of the progress. @@ -147,7 +183,7 @@ Use the omnibus packages of Enterprise Edition using [this guide](https://dev.gi **NOTE** Upgrader can only be tested when tags are pushed to all repositories. Do not forget to confirm it is working before releasing. Note that in the issue. -### **3. Fix anything coming out of the QA** +### **2. Fix anything coming out of the QA** Create an issue with description of a problem, if it is quick fix fix yourself otherwise contact the team for advice. diff --git a/features/project/redirects.feature b/features/project/redirects.feature index 776ab83a87..a2e77e7bf3 100644 --- a/features/project/redirects.feature +++ b/features/project/redirects.feature @@ -31,3 +31,8 @@ Feature: Project Redirects And I click on "Sign In" And Authenticate Then I should be redirected to "Community" page + + Scenario: I visit private project page without signing in + When I visit project "Enterprise" page + And I get redirected to signin page where I sign in + Then I should be redirected to "Enterprise" page diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb index 787b0c3dac..80fc241b75 100644 --- a/features/steps/group/group.rb +++ b/features/steps/group/group.rb @@ -201,7 +201,6 @@ class Groups < Spinach::FeatureSteps step 'I should see group milestone with descriptions and expiry date' do page.should have_content('Lorem Ipsum is simply dummy text of the printing and typesetting industry') page.should have_content('expires at Aug 20, 2014') - page.should have_content('Project milestone has no description') end step 'I should see group milestone with all issues and MRs assigned to that milestone' do diff --git a/features/steps/project/browse_commits.rb b/features/steps/project/browse_commits.rb index bd944dee61..fe47a73191 100644 --- a/features/steps/project/browse_commits.rb +++ b/features/steps/project/browse_commits.rb @@ -61,8 +61,7 @@ class ProjectBrowseCommits < Spinach::FeatureSteps Then 'I see big commit warning' do page.should have_content BigCommits::BIG_COMMIT_MESSAGE - page.should have_content "Warning! This is a large diff" - page.should have_content "If you still want to see the diff" + page.should have_content "Too many changes" end Given 'I visit huge commit page' do @@ -71,8 +70,6 @@ class ProjectBrowseCommits < Spinach::FeatureSteps Then 'I see huge commit message' do page.should have_content BigCommits::HUGE_COMMIT_MESSAGE - page.should have_content "Warning! This is a large diff" - page.should_not have_content "If you still want to see the diff" end Given 'I visit a commit with an image that changed' do diff --git a/features/steps/project/redirects.rb b/features/steps/project/redirects.rb index 5a4342dba3..25d37fd788 100644 --- a/features/steps/project/redirects.rb +++ b/features/steps/project/redirects.rb @@ -41,7 +41,6 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps step 'Authenticate' do admin = create(:admin) project = Project.find_by(name: 'Community') - find(:xpath, "//input[@id='return_to']").set "/#{project.path_with_namespace}" fill_in "user_login", with: admin.email fill_in "user_password", with: admin.password click_button "Sign in" @@ -53,5 +52,19 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps page.current_path.should == "/#{project.path_with_namespace}" page.status_code.should == 200 end -end + step 'I get redirected to signin page where I sign in' do + admin = create(:admin) + project = Project.find_by(name: 'Enterprise') + fill_in "user_login", with: admin.email + fill_in "user_password", with: admin.password + click_button "Sign in" + Thread.current[:current_user] = admin + end + + step 'I should be redirected to "Enterprise" page' do + project = Project.find_by(name: 'Enterprise') + page.current_path.should == "/#{project.path_with_namespace}" + page.status_code.should == 200 + end +end diff --git a/lib/gitlab/satellite/compare_action.rb b/lib/gitlab/satellite/compare_action.rb index c923bb9c0f..9c9e69e351 100644 --- a/lib/gitlab/satellite/compare_action.rb +++ b/lib/gitlab/satellite/compare_action.rb @@ -1,5 +1,7 @@ module Gitlab module Satellite + class BranchesWithoutParent < StandardError; end + class CompareAction < Action def initialize(user, target_project, target_branch, source_project, source_branch) super user, target_project @@ -22,7 +24,7 @@ module Gitlab diffs end rescue Grit::Git::CommandFailed => ex - handle_exception(ex) + raise BranchesWithoutParent end # Retrieve an array of commits between the source and the target diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb index 05123ad9c4..7c058b58c4 100644 --- a/lib/gitlab/satellite/satellite.rb +++ b/lib/gitlab/satellite/satellite.rb @@ -53,7 +53,7 @@ module Gitlab File.open(lock_file, "w+") do |f| begin f.flock File::LOCK_EX - Dir.chdir(path) { return yield } + yield ensure f.flock File::LOCK_UN end