Commit c0a7f876 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq

Conflicts:
	app/helpers/merge_requests_helper.rb
parents 47308303 5738afdb
...@@ -13,6 +13,7 @@ v 7.10.0 (unreleased) ...@@ -13,6 +13,7 @@ v 7.10.0 (unreleased)
- Identical look of selectboxes in UI - Identical look of selectboxes in UI
- Move "Import existing repository by URL" option to button. - Move "Import existing repository by URL" option to button.
- Improve error message when save profile has error. - Improve error message when save profile has error.
- Passing the name of pushed ref to CI service (requires GitLab CI 7.9+)
v 7.9.0 (unreleased) v 7.9.0 (unreleased)
- Add HipChat integration documentation (Stan Hu) - Add HipChat integration documentation (Stan Hu)
......
...@@ -31,7 +31,7 @@ gem 'omniauth-shibboleth' ...@@ -31,7 +31,7 @@ gem 'omniauth-shibboleth'
gem 'omniauth-kerberos' gem 'omniauth-kerberos'
gem 'omniauth-gitlab' gem 'omniauth-gitlab'
gem 'omniauth-bitbucket' gem 'omniauth-bitbucket'
gem 'doorkeeper', '2.1.0' gem 'doorkeeper', '2.1.3'
gem "rack-oauth2", "~> 1.0.5" gem "rack-oauth2", "~> 1.0.5"
# Browser detection # Browser detection
...@@ -49,7 +49,7 @@ gem 'gitlab_omniauth-ldap', '1.2.1', require: "omniauth-ldap" ...@@ -49,7 +49,7 @@ gem 'gitlab_omniauth-ldap', '1.2.1', require: "omniauth-ldap"
gem 'net-ldap' gem 'net-ldap'
# Git Wiki # Git Wiki
gem 'gollum-lib', '~> 4.0.0' gem 'gollum-lib', '~> 4.0.2'
# Language detection # Language detection
gem "gitlab-linguist", "~> 3.0.1", require: "linguist" gem "gitlab-linguist", "~> 3.0.1", require: "linguist"
......
...@@ -136,8 +136,8 @@ GEM ...@@ -136,8 +136,8 @@ GEM
diff-lcs (1.2.5) diff-lcs (1.2.5)
diffy (3.0.3) diffy (3.0.3)
docile (1.1.5) docile (1.1.5)
doorkeeper (2.1.0) doorkeeper (2.1.3)
railties (>= 3.1) railties (>= 3.2)
dotenv (0.9.0) dotenv (0.9.0)
dropzonejs-rails (0.4.14) dropzonejs-rails (0.4.14)
rails (> 3.1) rails (> 3.1)
...@@ -223,11 +223,11 @@ GEM ...@@ -223,11 +223,11 @@ GEM
omniauth (~> 1.0) omniauth (~> 1.0)
pyu-ruby-sasl (~> 0.0.3.1) pyu-ruby-sasl (~> 0.0.3.1)
rubyntlm (~> 0.3) rubyntlm (~> 0.3)
gollum-grit_adapter (0.1.0) gollum-grit_adapter (0.1.3)
gitlab-grit (~> 2.7.1) gitlab-grit (~> 2.7, >= 2.7.1)
gollum-lib (4.0.0) gollum-lib (4.0.2)
github-markup (~> 1.3.1) github-markup (~> 1.3.1)
gollum-grit_adapter (~> 0.1.0) gollum-grit_adapter (~> 0.1, >= 0.1.1)
nokogiri (~> 1.6.4) nokogiri (~> 1.6.4)
rouge (~> 1.7.4) rouge (~> 1.7.4)
sanitize (~> 2.1.0) sanitize (~> 2.1.0)
...@@ -481,7 +481,7 @@ GEM ...@@ -481,7 +481,7 @@ GEM
rest-client (1.6.7) rest-client (1.6.7)
mime-types (>= 1.16) mime-types (>= 1.16)
rinku (1.7.3) rinku (1.7.3)
rouge (1.7.4) rouge (1.7.7)
rspec (2.99.0) rspec (2.99.0)
rspec-core (~> 2.99.0) rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0) rspec-expectations (~> 2.99.0)
...@@ -688,7 +688,7 @@ DEPENDENCIES ...@@ -688,7 +688,7 @@ DEPENDENCIES
devise (= 3.2.4) devise (= 3.2.4)
devise-async (= 0.9.0) devise-async (= 0.9.0)
diffy (~> 3.0.3) diffy (~> 3.0.3)
doorkeeper (= 2.1.0) doorkeeper (= 2.1.3)
dropzonejs-rails dropzonejs-rails
email_spec email_spec
enumerize enumerize
...@@ -706,7 +706,7 @@ DEPENDENCIES ...@@ -706,7 +706,7 @@ DEPENDENCIES
gitlab_git (~> 7.1.2) gitlab_git (~> 7.1.2)
gitlab_meta (= 7.0) gitlab_meta (= 7.0)
gitlab_omniauth-ldap (= 1.2.1) gitlab_omniauth-ldap (= 1.2.1)
gollum-lib (~> 4.0.0) gollum-lib (~> 4.0.2)
gon (~> 5.0.0) gon (~> 5.0.0)
grape (~> 0.6.1) grape (~> 0.6.1)
grape-entity (~> 0.4.2) grape-entity (~> 0.4.2)
......
...@@ -19,6 +19,6 @@ class @Issue ...@@ -19,6 +19,6 @@ class @Issue
$('.issue-details').waitForImages -> $('.issue-details').waitForImages ->
$('.issuable-affix').affix offset: $('.issuable-affix').affix offset:
top: -> top: ->
@top = $('.issue-details').outerHeight(true) + 25 @top = ($('.issuable-affix').offset().top - 70)
bottom: -> bottom: ->
@bottom = $('.footer').outerHeight(true) @bottom = $('.footer').outerHeight(true)
...@@ -23,7 +23,7 @@ class @MergeRequest ...@@ -23,7 +23,7 @@ class @MergeRequest
$('.merge-request-details').waitForImages -> $('.merge-request-details').waitForImages ->
$('.issuable-affix').affix offset: $('.issuable-affix').affix offset:
top: -> top: ->
@top = $('.merge-request-details').outerHeight(true) + 91 @top = ($('.issuable-affix').offset().top - 70)
bottom: -> bottom: ->
@bottom = $('.footer').outerHeight(true) @bottom = $('.footer').outerHeight(true)
......
...@@ -425,7 +425,7 @@ class @Notes ...@@ -425,7 +425,7 @@ class @Notes
@removeDiscussionNoteForm(form) @removeDiscussionNoteForm(form)
updateVotes: -> updateVotes: ->
(new NotesVotes).updateVotes() true
### ###
Called after an attachment file has been selected. Called after an attachment file has been selected.
......
class @NotesVotes
updateVotes: ->
votes = $("#votes .votes")
notes = $("#notes-list .note .vote")
# only update if there is a vote display
if votes.size()
upvotes = notes.filter(".upvote").size()
downvotes = notes.filter(".downvote").size()
votesCount = upvotes + downvotes
upvotesPercent = (if votesCount then (100.0 / votesCount * upvotes) else 0)
downvotesPercent = (if votesCount then (100.0 - upvotesPercent) else 0)
# change vote bar lengths
votes.find(".bar-success").css "width", upvotesPercent + "%"
votes.find(".bar-danger").css "width", downvotesPercent + "%"
# replace vote numbers
votes.find(".upvotes").text votes.find(".upvotes").text().replace(/\d+/, upvotes)
votes.find(".downvotes").text votes.find(".downvotes").text().replace(/\d+/, downvotes)
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
line-height: 24px; line-height: 24px;
.str-truncated { .str-truncated {
max-width: 75%; max-width: 72%;
} }
a { a {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
} }
.issuable-context-title { .issuable-context-title {
font-size: 15px; font-size: 14px;
line-height: 1.4; line-height: 1.4;
margin-bottom: 5px; margin-bottom: 5px;
...@@ -39,3 +39,9 @@ ...@@ -39,3 +39,9 @@
margin-right: 4px; margin-right: 4px;
} }
} }
.issuable-affix .context {
font-size: 13px;
.btn { font-size: 13px; }
}
.votes {
font-size: 13px;
line-height: 15px;
.progress {
height: 4px;
margin: 0;
.bar {
float: left;
height: 100%;
}
.bar-success {
@include linear-gradient(#62C462, #51A351);
background-color: #468847;
}
.bar-danger {
@include linear-gradient(#EE5F5B, #BD362F);
background-color: #B94A48;
}
}
.upvotes {
display: inline-block;
color: #468847;
}
.downvotes {
display: inline-block;
color: #B94A48;
}
}
.votes-block {
margin: 6px;
.downvotes {
float: right;
}
}
.votes-inline { .votes-inline {
display: inline-block; display: inline-block;
margin: 0 8px; margin: 0 8px;
} }
...@@ -160,10 +160,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -160,10 +160,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def ci_status def ci_status
ci_service = @merge_request.source_project.ci_service ci_service = @merge_request.source_project.ci_service
status = ci_service.commit_status(merge_request.last_commit.sha) status = ci_service.commit_status(merge_request.last_commit.sha, merge_request.source_branch)
if ci_service.respond_to?(:commit_coverage) if ci_service.respond_to?(:commit_coverage)
coverage = ci_service.commit_coverage(merge_request.last_commit.sha) coverage = ci_service.commit_coverage(merge_request.last_commit.sha, merge_request.source_branch)
end end
response = { response = {
......
...@@ -34,8 +34,8 @@ module MergeRequestsHelper ...@@ -34,8 +34,8 @@ module MergeRequestsHelper
classes classes
end end
def ci_build_details_path merge_request def ci_build_details_path(merge_request)
build_url = merge_request.source_project.ci_service.build_page(merge_request.last_commit.sha) build_url = merge_request.source_project.ci_service.build_page(merge_request.last_commit.sha, merge_request.source_branch)
parsed_url = URI.parse(build_url) parsed_url = URI.parse(build_url)
unless parsed_url.userinfo.blank? unless parsed_url.userinfo.blank?
......
...@@ -98,11 +98,11 @@ class MergeRequest < ActiveRecord::Base ...@@ -98,11 +98,11 @@ class MergeRequest < ActiveRecord::Base
end end
event :mark_as_mergeable do event :mark_as_mergeable do
transition unchecked: :can_be_merged transition [:unchecked, :cannot_be_merged] => :can_be_merged
end end
event :mark_as_unmergeable do event :mark_as_unmergeable do
transition unchecked: :cannot_be_merged transition [:unchecked, :can_be_merged] => :cannot_be_merged
end end
state :unchecked state :unchecked
......
...@@ -93,7 +93,7 @@ class BambooService < CiService ...@@ -93,7 +93,7 @@ class BambooService < CiService
end end
end end
def build_page(sha) def build_page(sha, ref)
build_info(sha) if @response.nil? || !@response.code build_info(sha) if @response.nil? || !@response.code
if @response.code != 200 || @response['results']['results']['size'] == '0' if @response.code != 200 || @response['results']['results']['size'] == '0'
...@@ -106,7 +106,7 @@ class BambooService < CiService ...@@ -106,7 +106,7 @@ class BambooService < CiService
end end
end end
def commit_status(sha) def commit_status(sha, ref)
build_info(sha) if @response.nil? || !@response.code build_info(sha) if @response.nil? || !@response.code
return :error unless @response.code == 200 || @response.code == 404 return :error unless @response.code == 200 || @response.code == 404
......
...@@ -48,7 +48,7 @@ class BuildboxService < CiService ...@@ -48,7 +48,7 @@ class BuildboxService < CiService
service_hook.execute(data) service_hook.execute(data)
end end
def commit_status(sha) def commit_status(sha, ref)
response = HTTParty.get(commit_status_path(sha), verify: false) response = HTTParty.get(commit_status_path(sha), verify: false)
if response.code == 200 && response['status'] if response.code == 200 && response['status']
...@@ -62,7 +62,7 @@ class BuildboxService < CiService ...@@ -62,7 +62,7 @@ class BuildboxService < CiService
"#{buildbox_endpoint('gitlab')}/status/#{status_token}.json?commit=#{sha}" "#{buildbox_endpoint('gitlab')}/status/#{status_token}.json?commit=#{sha}"
end end
def build_page(sha) def build_page(sha, ref)
"#{project_url}/builds?commit=#{sha}" "#{project_url}/builds?commit=#{sha}"
end end
......
...@@ -34,7 +34,7 @@ class CiService < Service ...@@ -34,7 +34,7 @@ class CiService < Service
# Ex. # Ex.
# http://jenkins.example.com:8888/job/test1/scm/bySHA1/12d65c # http://jenkins.example.com:8888/job/test1/scm/bySHA1/12d65c
# #
def build_page(sha) def build_page(sha, ref)
# implement inside child # implement inside child
end end
...@@ -51,7 +51,7 @@ class CiService < Service ...@@ -51,7 +51,7 @@ class CiService < Service
# # => 'running' # # => 'running'
# #
# #
def commit_status(sha) def commit_status(sha, ref)
# implement inside child # implement inside child
end end
end end
...@@ -40,17 +40,17 @@ class GitlabCiService < CiService ...@@ -40,17 +40,17 @@ class GitlabCiService < CiService
service_hook.execute(data) service_hook.execute(data)
end end
def commit_status_path(sha) def commit_status_path(sha, ref)
project_url + "/commits/#{sha}/status.json?token=#{token}" project_url + "/refs/#{ref}/commits/#{sha}/status.json?token=#{token}"
end end
def get_ci_build(sha) def get_ci_build(sha, ref)
@ci_builds ||= {} @ci_builds ||= {}
@ci_builds[sha] ||= HTTParty.get(commit_status_path(sha), verify: false) @ci_builds[sha] ||= HTTParty.get(commit_status_path(sha, ref), verify: false)
end end
def commit_status(sha) def commit_status(sha, ref)
response = get_ci_build(sha) response = get_ci_build(sha, ref)
if response.code == 200 and response["status"] if response.code == 200 and response["status"]
response["status"] response["status"]
...@@ -59,16 +59,16 @@ class GitlabCiService < CiService ...@@ -59,16 +59,16 @@ class GitlabCiService < CiService
end end
end end
def commit_coverage(sha) def commit_coverage(sha, ref)
response = get_ci_build(sha) response = get_ci_build(sha, ref)
if response.code == 200 and response["coverage"] if response.code == 200 and response["coverage"]
response["coverage"] response["coverage"]
end end
end end
def build_page(sha) def build_page(sha, ref)
project_url + "/commits/#{sha}" project_url + "/refs/#{ref}/commits/#{sha}"
end end
def builds_path def builds_path
......
...@@ -88,7 +88,7 @@ class TeamcityService < CiService ...@@ -88,7 +88,7 @@ class TeamcityService < CiService
@response = HTTParty.get("#{url}", verify: false, basic_auth: auth) @response = HTTParty.get("#{url}", verify: false, basic_auth: auth)
end end
def build_page(sha) def build_page(sha, ref)
build_info(sha) if @response.nil? || !@response.code build_info(sha) if @response.nil? || !@response.code
if @response.code != 200 if @response.code != 200
...@@ -103,7 +103,7 @@ class TeamcityService < CiService ...@@ -103,7 +103,7 @@ class TeamcityService < CiService
end end
end end
def commit_status(sha) def commit_status(sha, ref)
build_info(sha) if @response.nil? || !@response.code build_info(sha) if @response.nil? || !@response.code
return :error unless @response.code == 200 || @response.code == 404 return :error unless @response.code == 200 || @response.code == 404
......
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
= link_to 'Close Issue', issue_path(@issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close js-note-target-close", title: "Close Issue" = link_to 'Close Issue', issue_path(@issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close js-note-target-close", title: "Close Issue"
.row .row
%section.col-md-9 %section.col-md-9
.votes-holder.pull-right
#votes= render 'votes/votes_block', votable: @issue
.participants .participants
%span= pluralize(@issue.participants.count, 'participant') %span= pluralize(@issue.participants.count, 'participant')
- @issue.participants.each do |participant| - @issue.participants.each do |participant|
= link_to_member(@project, participant, name: false, size: 24) = link_to_member(@project, participant, name: false, size: 24)
.voting_notes#notes= render "projects/notes/notes_with_form" .voting_notes#notes= render "projects/notes/notes_with_form"
%aside.col-md-3 %aside.col-md-3
.issuable-affix .issuable-affix
...@@ -20,15 +21,10 @@ ...@@ -20,15 +21,10 @@
%hr %hr
.context .context
= render partial: 'issue_context', locals: { issue: @issue } = render partial: 'issue_context', locals: { issue: @issue }
%hr
.clearfix
.votes-holder
%h6 Votes
#votes= render 'votes/votes_block', votable: @issue
- if @issue.labels.any? - if @issue.labels.any?
%hr .issuable-context-title
%h6 Labels %label Labels
.issue-show-labels .issue-show-labels
- @issue.labels.each do |label| - @issue.labels.each do |label|
= link_to namespace_project_issues_path(@project.namespace, @project, label_name: label.name) do = link_to namespace_project_issues_path(@project.namespace, @project, label_name: label.name) do
......
...@@ -45,5 +45,5 @@ ...@@ -45,5 +45,5 @@
:coffeescript :coffeescript
$ -> $ ->
new Subscription("#{toggle_subscription_namespace_project_issue_path(@issue.project.namespace, @project, @issue)}") new Subscription("#{toggle_subscription_namespace_project_issue_path(@issue.project.namespace, @project, @issue)}")
\ No newline at end of file
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
.row .row
%section.col-md-9 %section.col-md-9
.votes-holder.pull-right
#votes= render 'votes/votes_block', votable: @merge_request
= render "projects/merge_requests/show/participants" = render "projects/merge_requests/show/participants"
= render "projects/notes/notes_with_form" = render "projects/notes/notes_with_form"
%aside.col-md-3 %aside.col-md-3
...@@ -17,14 +19,10 @@ ...@@ -17,14 +19,10 @@
%hr %hr
.context .context
= render partial: 'projects/merge_requests/show/context', locals: { merge_request: @merge_request } = render partial: 'projects/merge_requests/show/context', locals: { merge_request: @merge_request }
%hr
.votes-holder
%h6 Votes
#votes= render 'votes/votes_block', votable: @merge_request
- if @merge_request.labels.any? - if @merge_request.labels.any?
%hr .issuable-context-title
%h6 Labels %label Labels
.merge-request-show-labels .merge-request-show-labels
- @merge_request.labels.each do |label| - @merge_request.labels.each do |label|
= link_to namespace_project_merge_requests_path(@project.namespace, @project, label_name: label.name) do = link_to namespace_project_merge_requests_path(@project.namespace, @project, label_name: label.name) do
......
.votes.votes-block .votes.votes-block
.progress .btn-group
.progress-bar.progress-bar-success{style: "width: #{votable.upvotes_in_percent}%;"} - unless votable.upvotes.zero?
.progress-bar.progress-bar-danger{style: "width: #{votable.downvotes_in_percent}%;"} .btn.btn-sm.disabled.cgreen
.upvotes= "#{votable.upvotes} up" %i.fa.fa-thumbs-up
.downvotes= "#{votable.downvotes} down" = votable.upvotes
- unless votable.downvotes.zero?
.btn.btn-sm.disabled.cred
%i.fa.fa-thumbs-down
= votable.downvotes
.votes.votes-inline .votes.votes-inline
- unless votable.upvotes.zero? - unless votable.upvotes.zero?
.upvotes %span.upvotes.cgreen
+ #{votable.upvotes} + #{votable.upvotes}
- unless votable.downvotes.zero? - unless votable.downvotes.zero?
\/ \/
- unless votable.downvotes.zero? - unless votable.downvotes.zero?
.downvotes %span.downvotes.cred
\- #{votable.downvotes} \- #{votable.downvotes}
...@@ -350,14 +350,6 @@ Gitlab::Application.routes.draw do ...@@ -350,14 +350,6 @@ Gitlab::Application.routes.draw do
as: :tree as: :tree
) )
end end
resource :avatar, only: [:show, :destroy]
resources :commit, only: [:show], constraints: { id: /[[:alnum:]]{6,40}/ } do
get :branches, on: :member
end
resources :commits, only: [:show], constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }
resources :compare, only: [:index, :create]
scope do scope do
get( get(
...@@ -368,8 +360,24 @@ Gitlab::Application.routes.draw do ...@@ -368,8 +360,24 @@ Gitlab::Application.routes.draw do
) )
end end
resources :network, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } scope do
resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do get(
'/commits/*id',
to: 'commits#show',
constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ },
as: :commits
)
end
resource :avatar, only: [:show, :destroy]
resources :commit, only: [:show], constraints: { id: /[[:alnum:]]{6,40}/ } do
get :branches, on: :member
end
resources :compare, only: [:index, :create]
resources :network, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ }
resources :graphs, only: [:show], constraints: { id: /(?:[^.]|\.(?!json$))+/, format: /json/ } do
member do member do
get :commits get :commits
end end
......
...@@ -59,7 +59,7 @@ describe BuildboxService do ...@@ -59,7 +59,7 @@ describe BuildboxService do
describe :build_page do describe :build_page do
it 'returns the correct build page' do it 'returns the correct build page' do
expect(@service.build_page('2ab7834c')).to eq( expect(@service.build_page('2ab7834c', nil)).to eq(
'https://buildbox.io/account-name/example-project/builds?commit=2ab7834c' 'https://buildbox.io/account-name/example-project/builds?commit=2ab7834c'
) )
end end
......
...@@ -39,11 +39,11 @@ describe GitlabCiService do ...@@ -39,11 +39,11 @@ describe GitlabCiService do
end end
describe :commit_status_path do describe :commit_status_path do
it { expect(@service.commit_status_path("2ab7834c")).to eq("http://ci.gitlab.org/projects/2/commits/2ab7834c/status.json?token=verySecret")} it { expect(@service.commit_status_path("2ab7834c", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/2ab7834c/status.json?token=verySecret")}
end end
describe :build_page do describe :build_page do
it { expect(@service.build_page("2ab7834c")).to eq("http://ci.gitlab.org/projects/2/commits/2ab7834c")} it { expect(@service.build_page("2ab7834c", 'master')).to eq("http://ci.gitlab.org/projects/2/refs/master/commits/2ab7834c")}
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment