Commit ba37f840 authored by Job van der Voort's avatar Job van der Voort

Merge branch 'master' into monthly-revision

Conflicts:
	doc/release/monthly.md
parents db7f0738 172ad962
v 6.9.0
- Store Rails cache data in the Redis `cache:gitlab` namespace
- Adjust MySQL limits for existing installations
- Add db index on project_id+iid column. This prevents duplicate on iid (During migration duplicates will be removed)
- Markdown preview or diff during editing via web editor (Evgeniy Sokovikov)
- Give the Rails cache its own Redis namespace
- Add ability to set different ssh host, if different from http/https
- Fix syntax highlighting for code comments blocks
- Improve comments loading logic
- Stop refreshing comments when the tab is hidden
v 6.8.0 v 6.8.0
- Ability to at mention users that are participating in issue and merge req. discussion - Ability to at mention users that are participating in issue and merge req. discussion
- Enabled GZip Compression for assets in example Nginx, make sure that Nginx is compiled with --with-http_gzip_static_module flag (this is default in Ubuntu) - Enabled GZip Compression for assets in example Nginx, make sure that Nginx is compiled with --with-http_gzip_static_module flag (this is default in Ubuntu)
...@@ -17,7 +28,6 @@ v 6.8.0 ...@@ -17,7 +28,6 @@ v 6.8.0
- Fix download link for huge MR diffs - Fix download link for huge MR diffs
- Expose event and mergerequest timestamps in API - Expose event and mergerequest timestamps in API
- Fix emails on push service when only one commit is pushed - Fix emails on push service when only one commit is pushed
- Store Rails cache data in the Redis `cache:gitlab` namespace
v 6.7.3 v 6.7.3
- Fix the merge notification email not being sent (Pierre de La Morinerie) - Fix the merge notification email not being sent (Pierre de La Morinerie)
......
...@@ -71,6 +71,7 @@ gem "carrierwave" ...@@ -71,6 +71,7 @@ gem "carrierwave"
# for aws storage # for aws storage
gem "fog", "~> 1.14", group: :aws gem "fog", "~> 1.14", group: :aws
gem "unf", group: :aws
# Authorization # Authorization
gem "six" gem "six"
...@@ -82,6 +83,9 @@ gem "seed-fu" ...@@ -82,6 +83,9 @@ gem "seed-fu"
gem "redcarpet", "~> 2.2.2" gem "redcarpet", "~> 2.2.2"
gem "github-markup" gem "github-markup"
# Diffs
gem 'diffy', '~> 3.0.3'
# Asciidoc to HTML # Asciidoc to HTML
gem "asciidoctor" gem "asciidoctor"
...@@ -157,8 +161,8 @@ gem 'jquery-turbolinks' ...@@ -157,8 +161,8 @@ gem 'jquery-turbolinks'
gem 'select2-rails' gem 'select2-rails'
gem 'jquery-atwho-rails', "~> 0.3.3" gem 'jquery-atwho-rails', "~> 0.3.3"
gem "jquery-rails", "2.1.3" gem "jquery-rails"
gem "jquery-ui-rails", "2.0.2" gem "jquery-ui-rails"
gem "raphael-rails", "~> 2.1.2" gem "raphael-rails", "~> 2.1.2"
gem 'bootstrap-sass', '~> 3.0' gem 'bootstrap-sass', '~> 3.0'
gem "font-awesome-rails", '~> 3.2' gem "font-awesome-rails", '~> 3.2'
...@@ -232,4 +236,4 @@ end ...@@ -232,4 +236,4 @@ end
group :production do group :production do
gem "gitlab_meta", '6.0' gem "gitlab_meta", '6.0'
end end
\ No newline at end of file
...@@ -34,7 +34,6 @@ GEM ...@@ -34,7 +34,6 @@ GEM
rake (>= 0.8.7) rake (>= 0.8.7)
arel (4.0.2) arel (4.0.2)
asciidoctor (0.1.4) asciidoctor (0.1.4)
atomic (1.1.16)
awesome_print (1.2.0) awesome_print (1.2.0)
axiom-types (0.0.5) axiom-types (0.0.5)
descendants_tracker (~> 0.0.1) descendants_tracker (~> 0.0.1)
...@@ -101,6 +100,7 @@ GEM ...@@ -101,6 +100,7 @@ GEM
devise-async (0.8.0) devise-async (0.8.0)
devise (>= 2.2, < 3.2) devise (>= 2.2, < 3.2)
diff-lcs (1.2.5) diff-lcs (1.2.5)
diffy (3.0.3)
docile (1.1.1) docile (1.1.1)
dotenv (0.9.0) dotenv (0.9.0)
email_spec (1.5.0) email_spec (1.5.0)
...@@ -247,15 +247,14 @@ GEM ...@@ -247,15 +247,14 @@ GEM
rake rake
jasmine-core (2.0.0.rc5) jasmine-core (2.0.0.rc5)
jquery-atwho-rails (0.3.3) jquery-atwho-rails (0.3.3)
jquery-rails (2.1.3) jquery-rails (3.1.0)
railties (>= 3.1.0, < 5.0) railties (>= 3.0, < 5.0)
thor (~> 0.14) thor (>= 0.14, < 2.0)
jquery-turbolinks (2.0.1) jquery-turbolinks (2.0.1)
railties (>= 3.1.0) railties (>= 3.1.0)
turbolinks turbolinks
jquery-ui-rails (2.0.2) jquery-ui-rails (4.2.1)
jquery-rails railties (>= 3.2.16)
railties (>= 3.1.0)
json (1.8.1) json (1.8.1)
jwt (0.1.8) jwt (0.1.8)
multi_json (>= 1.5) multi_json (>= 1.5)
...@@ -280,7 +279,7 @@ GEM ...@@ -280,7 +279,7 @@ GEM
mime-types (1.25.1) mime-types (1.25.1)
mini_portile (0.5.3) mini_portile (0.5.3)
minitest (4.7.5) minitest (4.7.5)
multi_json (1.9.2) multi_json (1.9.3)
multi_xml (0.5.5) multi_xml (0.5.5)
multipart-post (1.2.0) multipart-post (1.2.0)
mysql2 (0.3.11) mysql2 (0.3.11)
...@@ -375,7 +374,7 @@ GEM ...@@ -375,7 +374,7 @@ GEM
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
raindrops (0.12.0) raindrops (0.12.0)
rake (10.1.1) rake (10.3.1)
raphael-rails (2.1.2) raphael-rails (2.1.2)
rb-fsevent (0.9.3) rb-fsevent (0.9.3)
rb-inotify (0.9.2) rb-inotify (0.9.2)
...@@ -502,9 +501,8 @@ GEM ...@@ -502,9 +501,8 @@ GEM
daemons (>= 1.0.9) daemons (>= 1.0.9)
eventmachine (>= 1.0.0) eventmachine (>= 1.0.0)
rack (>= 1.0.0) rack (>= 1.0.0)
thor (0.18.1) thor (0.19.1)
thread_safe (0.3.1) thread_safe (0.3.3)
atomic (>= 1.1.7, < 2)
tilt (1.4.1) tilt (1.4.1)
timers (1.1.0) timers (1.1.0)
tinder (1.9.3) tinder (1.9.3)
...@@ -531,6 +529,9 @@ GEM ...@@ -531,6 +529,9 @@ GEM
execjs (>= 0.3.0) execjs (>= 0.3.0)
json (>= 1.8.0) json (>= 1.8.0)
underscore-rails (1.4.4) underscore-rails (1.4.4)
unf (0.1.4)
unf_ext
unf_ext (0.0.6)
unicorn (4.6.3) unicorn (4.6.3)
kgio (~> 2.6) kgio (~> 2.6)
rack rack
...@@ -574,6 +575,7 @@ DEPENDENCIES ...@@ -574,6 +575,7 @@ DEPENDENCIES
default_value_for (~> 3.0.0) default_value_for (~> 3.0.0)
devise (= 3.0.4) devise (= 3.0.4)
devise-async (= 0.8.0) devise-async (= 0.8.0)
diffy (~> 3.0.3)
email_spec email_spec
email_validator (~> 1.4.0) email_validator (~> 1.4.0)
enumerize enumerize
...@@ -603,9 +605,9 @@ DEPENDENCIES ...@@ -603,9 +605,9 @@ DEPENDENCIES
httparty httparty
jasmine (= 2.0.0.rc5) jasmine (= 2.0.0.rc5)
jquery-atwho-rails (~> 0.3.3) jquery-atwho-rails (~> 0.3.3)
jquery-rails (= 2.1.3) jquery-rails
jquery-turbolinks jquery-turbolinks
jquery-ui-rails (= 2.0.2) jquery-ui-rails
kaminari (~> 0.15.1) kaminari (~> 0.15.1)
launchy launchy
letter_opener letter_opener
...@@ -659,6 +661,7 @@ DEPENDENCIES ...@@ -659,6 +661,7 @@ DEPENDENCIES
turbolinks turbolinks
uglifier uglifier
underscore-rails (~> 1.4.4) underscore-rails (~> 1.4.4)
unf
unicorn (~> 4.6.3) unicorn (~> 4.6.3)
unicorn-worker-killer unicorn-worker-killer
version_sorter version_sorter
......
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
* [GitLab.com](https://www.gitlab.com/) includes information about [subscriptions](https://www.gitlab.com/subscription/), [consultancy](https://www.gitlab.com/consultancy/), the [community](https://www.gitlab.com/community/) and the [hosted GitLab Cloud](https://www.gitlab.com/cloud/). * [GitLab.com](https://www.gitlab.com/) includes information about [subscriptions](https://www.gitlab.com/subscription/), [consultancy](https://www.gitlab.com/consultancy/), the [community](https://www.gitlab.com/community/) and the [hosted GitLab Cloud](https://www.gitlab.com/cloud/).
* [GitLab Enterprise Edition](https://www.gitlab.com/gitlab-ce/) offers additional features that are useful for larger organizations (100+ users). * [GitLab Enterprise Edition](https://www.gitlab.com/gitlab-ee/) offers additional features aimed at larger organizations.
* [GitLab CI](https://www.gitlab.com/gitlab-ci/) is a continuous integration (CI) server that is easy to integrate with GitLab. * [GitLab CI](https://www.gitlab.com/gitlab-ci/) is a continuous integration (CI) server that is easy to integrate with GitLab.
* Unofficial third-party [iPhone app](http://gitlabcontrol.com/) and [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) for GitLab * Unofficial third-party [iPhone app](http://gitlabcontrol.com/)m [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) and [command line client](https://github.com/drewblessing/gitlab-cli) for GitLab.
### Requirements ### Requirements
......
...@@ -59,7 +59,7 @@ class Dispatcher ...@@ -59,7 +59,7 @@ class Dispatcher
initHighlight: -> initHighlight: ->
$('.highlight pre code').each (i, e) -> $('.highlight pre code').each (i, e) ->
hljs.highlightBlock(e)
$(e).html($.map($(e).html().split("\n"), (line, i) -> $(e).html($.map($(e).html().split("\n"), (line, i) ->
"<div class='line' id='LC" + (i + 1) + "'>" + line + "</div>" "<span class='line' id='LC" + (i + 1) + "'>" + line + "</span>"
).join("\n")) ).join("\n"))
hljs.highlightBlock(e)
class Notes class Notes
@interval: null @interval: null
constructor: (notes_url, note_ids) -> constructor: (notes_url, note_ids, last_fetched_at) ->
@notes_url = notes_url @notes_url = notes_url
@notes_url = gon.relative_url_root + @notes_url if gon.relative_url_root? @notes_url = gon.relative_url_root + @notes_url if gon.relative_url_root?
@note_ids = note_ids @note_ids = note_ids
@last_fetched_at = last_fetched_at
@initRefresh() @initRefresh()
@setupMainTargetNoteForm() @setupMainTargetNoteForm()
@cleanBinding() @cleanBinding()
...@@ -49,6 +50,9 @@ class Notes ...@@ -49,6 +50,9 @@ class Notes
# hide diff note form # hide diff note form
$(document).on "click", ".js-close-discussion-note-form", @cancelDiscussionForm $(document).on "click", ".js-close-discussion-note-form", @cancelDiscussionForm
# fetch notes when tab becomes visible
$(document).on "visibilitychange", @visibilityChange
cleanBinding: -> cleanBinding: ->
$(document).off "ajax:success", ".js-main-target-form" $(document).off "ajax:success", ".js-main-target-form"
$(document).off "ajax:success", ".js-discussion-note-form" $(document).off "ajax:success", ".js-discussion-note-form"
...@@ -62,6 +66,7 @@ class Notes ...@@ -62,6 +66,7 @@ class Notes
$(document).off "click", ".js-choose-note-attachment-button" $(document).off "click", ".js-choose-note-attachment-button"
$(document).off "click", ".js-discussion-reply-button" $(document).off "click", ".js-discussion-reply-button"
$(document).off "click", ".js-add-diff-note-button" $(document).off "click", ".js-add-diff-note-button"
$(document).off "visibilitychange"
initRefresh: -> initRefresh: ->
...@@ -71,14 +76,16 @@ class Notes ...@@ -71,14 +76,16 @@ class Notes
, 15000 , 15000
refresh: -> refresh: ->
@getContent() @getContent() unless document.hidden
getContent: -> getContent: ->
$.ajax $.ajax
url: @notes_url url: @notes_url
data: "last_fetched_at=" + @last_fetched_at
dataType: "json" dataType: "json"
success: (data) => success: (data) =>
notes = data.notes notes = data.notes
@last_fetched_at = data.last_fetched_at
$.each notes, (i, note) => $.each notes, (i, note) =>
@renderNote(note) @renderNote(note)
...@@ -450,4 +457,10 @@ class Notes ...@@ -450,4 +457,10 @@ class Notes
filename = $(this).val().replace(/^.*[\\\/]/, "") filename = $(this).val().replace(/^.*[\\\/]/, "")
form.find(".js-attachment-filename").text filename form.find(".js-attachment-filename").text filename
###
Called when the tab visibility changes
###
visibilityChange: =>
@refresh()
@Notes = Notes @Notes = Notes
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
margin-top: -5px; margin-top: -5px;
} }
.left-options {
margin-top: -3px;
}
.file_name { .file_name {
color: $style_color; color: $style_color;
font-size: 14px; font-size: 14px;
......
...@@ -12,6 +12,7 @@ class Admin::ProjectsController < Admin::ApplicationController ...@@ -12,6 +12,7 @@ class Admin::ProjectsController < Admin::ApplicationController
@projects = @projects.with_push if params[:with_push].present? @projects = @projects.with_push if params[:with_push].present?
@projects = @projects.abandoned if params[:abandoned].present? @projects = @projects.abandoned if params[:abandoned].present?
@projects = @projects.search(params[:name]) if params[:name].present? @projects = @projects.search(params[:name]) if params[:name].present?
@projects = @projects.sort(@sort = params[:sort])
@projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20) @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]).per(20)
end end
......
...@@ -26,6 +26,18 @@ class Projects::EditTreeController < Projects::BaseTreeController ...@@ -26,6 +26,18 @@ class Projects::EditTreeController < Projects::BaseTreeController
end end
end end
def preview
@content = params[:content]
#FIXME workaround https://github.com/gitlabhq/gitlabhq/issues/5936
@content += "\n" if @blob.data.end_with?("\n")
diffy = Diffy::Diff.new(@blob.data, @content, diff: '-U 3',
include_diff_info: true)
@diff = Gitlab::DiffParser.new(diffy.diff.scan(/.*\n/))
render layout: false
end
private private
def blob def blob
......
...@@ -5,9 +5,10 @@ class Projects::NotesController < Projects::ApplicationController ...@@ -5,9 +5,10 @@ class Projects::NotesController < Projects::ApplicationController
before_filter :authorize_admin_note!, only: [:update, :destroy] before_filter :authorize_admin_note!, only: [:update, :destroy]
def index def index
current_fetched_at = Time.now.to_i
@notes = NotesFinder.new.execute(project, current_user, params) @notes = NotesFinder.new.execute(project, current_user, params)
notes_json = { notes: [] } notes_json = { notes: [], last_fetched_at: current_fetched_at }
@notes.each do |note| @notes.each do |note|
notes_json[:notes] << { notes_json[:notes] << {
......
class NotesFinder class NotesFinder
FETCH_OVERLAP = 5.seconds
def execute(project, current_user, params) def execute(project, current_user, params)
target_type = params[:target_type] target_type = params[:target_type]
target_id = params[:target_id] target_id = params[:target_id]
# Default to 0 to remain compatible with old clients
last_fetched_at = Time.at(params.fetch(:last_fetched_at, 0).to_i)
case target_type notes = case target_type
when "commit" when "commit"
project.notes.for_commit_id(target_id).not_inline.fresh project.notes.for_commit_id(target_id).not_inline.fresh
when "issue" when "issue"
...@@ -12,6 +16,11 @@ class NotesFinder ...@@ -12,6 +16,11 @@ class NotesFinder
project.merge_requests.find(target_id).mr_and_commit_notes.inc_author.fresh project.merge_requests.find(target_id).mr_and_commit_notes.inc_author.fresh
when "snippet" when "snippet"
project.snippets.find(target_id).notes.fresh project.snippets.find(target_id).notes.fresh
else
raise 'invalid target_type'
end end
# Use overlapping intervals to avoid worrying about race conditions
notes.where('updated_at > ?', last_fetched_at - FETCH_OVERLAP)
end end
end end
...@@ -16,9 +16,10 @@ module CommitsHelper ...@@ -16,9 +16,10 @@ module CommitsHelper
end end
def each_diff_line(diff, index) def each_diff_line(diff, index)
Gitlab::DiffParser.new(diff).each do |full_line, type, line_code, line_new, line_old| Gitlab::DiffParser.new(diff.diff.lines.to_a, diff.new_path)
yield(full_line, type, line_code, line_new, line_old) .each do |full_line, type, line_code, line_new, line_old|
end yield(full_line, type, line_code, line_new, line_old)
end
end end
def each_diff_line_near(diff, index, expected_line_code) def each_diff_line_near(diff, index, expected_line_code)
......
...@@ -163,7 +163,7 @@ module ProjectsHelper ...@@ -163,7 +163,7 @@ module ProjectsHelper
end end
def repository_size(project = nil) def repository_size(project = nil)
"#{(project || @project).repository.size} MB" "#{(project || @project).repository_size} MB"
rescue rescue
# In order to prevent 500 error # In order to prevent 500 error
# when application cannot allocate memory # when application cannot allocate memory
......
...@@ -91,4 +91,12 @@ module TreeHelper ...@@ -91,4 +91,12 @@ module TreeHelper
def leave_edit_message def leave_edit_message
"Leave edit mode?\nAll unsaved changes will be lost." "Leave edit mode?\nAll unsaved changes will be lost."
end end
def editing_preview_title(filename)
if gitlab_markdown?(filename) || markup?(filename)
'Preview'
else
'Diff'
end
end
end end
...@@ -25,6 +25,7 @@ class Milestone < ActiveRecord::Base ...@@ -25,6 +25,7 @@ class Milestone < ActiveRecord::Base
scope :active, -> { with_state(:active) } scope :active, -> { with_state(:active) }
scope :closed, -> { with_state(:closed) } scope :closed, -> { with_state(:closed) }
scope :of_projects, ->(ids) { where(project_id: ids) }
validates :title, presence: true validates :title, presence: true
validates :project, presence: true validates :project, presence: true
......
...@@ -184,9 +184,10 @@ class Note < ActiveRecord::Base ...@@ -184,9 +184,10 @@ class Note < ActiveRecord::Base
return @diff_line if @diff_line return @diff_line if @diff_line
if diff if diff
Gitlab::DiffParser.new(diff).each do |full_line, type, line_code, line_new, line_old| Gitlab::DiffParser.new(diff.diff.lines.to_a, diff.new_path)
@diff_line = full_line if line_code == self.line_code .each do |full_line, type, line_code, line_new, line_old|
end @diff_line = full_line if line_code == self.line_code
end
end end
@diff_line @diff_line
......
...@@ -203,6 +203,7 @@ class Project < ActiveRecord::Base ...@@ -203,6 +203,7 @@ class Project < ActiveRecord::Base
when 'oldest' then reorder('projects.created_at ASC') when 'oldest' then reorder('projects.created_at ASC')
when 'recently_updated' then reorder('projects.updated_at DESC') when 'recently_updated' then reorder('projects.updated_at DESC')
when 'last_updated' then reorder('projects.updated_at ASC') when 'last_updated' then reorder('projects.updated_at ASC')
when 'largest_repository' then reorder('projects.repository_size DESC')
else reorder("namespaces.path, projects.name ASC") else reorder("namespaces.path, projects.name ASC")
end end
end end
...@@ -562,4 +563,8 @@ class Project < ActiveRecord::Base ...@@ -562,4 +563,8 @@ class Project < ActiveRecord::Base
def forked_from?(project) def forked_from?(project)
forked? && project == forked_from_project forked? && project == forked_from_project
end end
def update_repository_size
update_attribute(:repository_size, repository.size)
end
end end
...@@ -25,6 +25,7 @@ class GitPushService ...@@ -25,6 +25,7 @@ class GitPushService
project.ensure_satellite_exists project.ensure_satellite_exists
project.repository.expire_cache project.repository.expire_cache
project.update_repository_size
if push_to_existing_branch?(ref, oldrev) if push_to_existing_branch?(ref, oldrev)
project.update_merge_requests(oldrev, newrev, ref, @user) project.update_merge_requests(oldrev, newrev, ref, @user)
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
= f.label :color, "Background Color", class: 'control-label' = f.label :color, "Background Color", class: 'control-label'
.col-sm-10 .col-sm-10
= f.text_field :color, placeholder: "#AA33EE", class: "form-control" = f.text_field :color, placeholder: "#AA33EE", class: "form-control"
.light Hex values as 3 double digit numbers, starting with a # sign. .light 6 character hex values starting with a # sign.
.form-group.js-toggle-colors-container.hide .form-group.js-toggle-colors-container.hide
= f.label :font, "Font Color", class: 'control-label' = f.label :font, "Font Color", class: 'control-label'
.col-sm-10 .col-sm-10
= f.text_field :font, placeholder: "#224466", class: "form-control" = f.text_field :font, placeholder: "#224466", class: "form-control"
.light Hex values as 3 double digit numbers, starting with a # sign. .light 6 character hex values starting with a # sign.
.form-group .form-group
= f.label :starts_at, class: 'control-label' = f.label :starts_at, class: 'control-label'
.col-sm-10.datetime-controls .col-sm-10.datetime-controls
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
= visibility_level_icon(level) = visibility_level_icon(level)
= label = label
.form-actions .form-actions
= hidden_field_tag :sort, params[:sort]
= submit_tag "Search", class: "btn submit btn-primary" = submit_tag "Search", class: "btn submit btn-primary"
= link_to "Reset", admin_projects_path, class: "btn" = link_to "Reset", admin_projects_path, class: "btn"
...@@ -40,6 +41,28 @@ ...@@ -40,6 +41,28 @@
.title .title
Projects (#{@projects.total_count}) Projects (#{@projects.total_count})
.pull-right .pull-right
.dropdown.inline
%a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"}
%span.light sort:
- if @sort.present?
= @sort.humanize
- else
Name
%b.caret
%ul.dropdown-menu
%li
= link_to admin_projects_path(sort: nil) do
Name
= link_to admin_projects_path(sort: 'newest') do
Newest
= link_to admin_projects_path(sort: 'oldest') do
Oldest
= link_to admin_projects_path(sort: 'recently_updated') do
Recently updated
= link_to admin_projects_path(sort: 'last_updated') do
Last updated
= link_to admin_projects_path(sort: 'largest_repository') do
Largest repository
= link_to 'New Project', new_project_path, class: "btn btn-new" = link_to 'New Project', new_project_path, class: "btn btn-new"
%ul.well-list %ul.well-list
- @projects.each do |project| - @projects.each do |project|
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
%li.visible-sm.visible-xs %li.visible-sm.visible-xs
= link_to search_path, title: "Search", class: 'has_bottom_tooltip', 'data-original-title' => 'Search area' do = link_to search_path, title: "Search", class: 'has_bottom_tooltip', 'data-original-title' => 'Search area' do
%i.icon-search %i.icon-search
%li
= link_to help_path, title: 'Help', class: 'has_bottom_tooltip',
'data-original-title' => 'Help' do
%i.icon-question-sign
%li %li
= link_to public_root_path, title: "Public area", class: 'has_bottom_tooltip', 'data-original-title' => 'Public area' do = link_to public_root_path, title: "Public area", class: 'has_bottom_tooltip', 'data-original-title' => 'Public area' do
%i.icon-globe %i.icon-globe
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
%p.light %p.light
GitLab is open source software to collaborate on code. GitLab is open source software to collaborate on code.
%br %br
#{link_to "Sign in", new_user_session_path} or browse for #{link_to "public projects", public_projects_path}. Sign in or browse for #{link_to "public projects", public_projects_path}.
%hr %hr
.container .container
.content .content
......
...@@ -17,7 +17,7 @@ Changes: ...@@ -17,7 +17,7 @@ Changes:
- else - else
= diff.new_path || diff.old_path = diff.new_path || diff.old_path
\===================================== \=====================================
= diff.diff != diff.diff
\ \
- if @compare.timeout - if @compare.timeout
Huge diff. To prevent performance issues it was hidden Huge diff. To prevent performance issues it was hidden
......
%table.text-file
- each_diff_line(diff, 1) do |line, type, line_code, line_new, line_old, raw_line|
%tr.line_holder{ id: line_code, class: "#{type}" }
- if type == "match"
%td.old_line= "..."
%td.new_line= "..."
%td.line_content.matched= line
- else
%td.old_line
= link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", id: line_code
%td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line)
.diff-file
.diff-content
- if gitlab_markdown?(@blob.name)
.file-content.wiki
= preserve do
= markdown(@content)
- elsif markup?(@blob.name)
.file-content.wiki
= raw GitHub::Markup.render(@blob.name, @content)
- else
.file-content.code
- unless @diff.empty?
%table.text-file
- @diff.each do |line, type, line_code, line_new, line_old, raw_line|
%tr.line_holder{ id: line_code, class: "#{type}" }
- if type == "match"
%td.old_line= "..."
%td.new_line= "..."
%td.line_content.matched= line
- else
%td.old_line
= link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", id: line_code
%td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line)
- else
%p.nothing_here_message No changes.
%h3.page-title Edit mode %h3.page-title Edit mode
.file-editor .file-editor
= form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do = form_tag(project_edit_tree_path(@project, @id), method: :put, class: "form-horizontal") do
.file-holder .file-holder.file
.file-title .file-title
.btn-group.js-edit-mode.left-options
= link_to 'Edit', '#editor', class: 'active hover btn btn-tiny'
= link_to editing_preview_title(@blob.name), '#preview', class: 'btn btn-tiny', 'data-preview-url' => preview_project_edit_tree_path(@project, @id)
%i.icon-file %i.icon-file
%span.file_name %span.file_name
= @path = @path
...@@ -13,7 +16,8 @@ ...@@ -13,7 +16,8 @@
.btn-group.tree-btn-group .btn-group.tree-btn-group
= link_to "Cancel", @after_edit_path, class: "btn btn-tiny btn-cancel", data: { confirm: leave_edit_message } = link_to "Cancel", @after_edit_path, class: "btn btn-tiny btn-cancel", data: { confirm: leave_edit_message }
.file-content.code .file-content.code
%pre#editor= @blob.data %pre.js-edit-mode-pane#editor= @blob.data
.js-edit-mode-pane#preview.hide
.form-group.commit_message-group .form-group.commit_message-group
= label_tag 'commit_message', class: "control-label" do = label_tag 'commit_message', class: "control-label" do
...@@ -45,3 +49,28 @@ ...@@ -45,3 +49,28 @@
$("#file-content").val(editor.getValue()); $("#file-content").val(editor.getValue());
$(".file-editor form").submit(); $(".file-editor form").submit();
}); });
var editModePanes = $('.js-edit-mode-pane'),
editModeLinks = $('.js-edit-mode a');
editModeLinks.click(function(event) {
event.preventDefault();
var currentLink = $(this),
paneId = currentLink.attr('href'),
currentPane = editModePanes.filter(paneId);
editModeLinks.removeClass('active hover');
currentLink.addClass('active hover');
editModePanes.hide();
if (paneId == '#preview') {
$.post(currentLink.data('preview-url'), { content: editor.getValue() }, function(response) {
currentPane.empty().append(response);
currentPane.fadeIn(200);
})
} else {
currentPane.fadeIn(200);
editor.focus()
}
})
...@@ -26,4 +26,4 @@ ...@@ -26,4 +26,4 @@
.ci_widget.ci-error{style: "display:none"} .ci_widget.ci-error{style: "display:none"}
%i.icon-remove %i.icon-remove
%strong Cannot connect to CI server. Please check your setting %strong Cannot connect to the CI server. Please check your settings and try again.
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
= render "projects/notes/form" = render "projects/notes/form"
:javascript :javascript
new Notes("#{project_notes_path(target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}) new Notes("#{project_notes_path(target_id: @noteable.id, target_type: @noteable.class.name.underscore)}", #{@notes.map(&:id).to_json}, #{Time.now.to_i})
...@@ -107,7 +107,7 @@ production: &base ...@@ -107,7 +107,7 @@ production: &base
# ## :id - Issue id (from commit messages) # ## :id - Issue id (from commit messages)
# issues_url: "http://redmine.sample/issues/:id" # issues_url: "http://redmine.sample/issues/:id"
# #
# ## If not nil, linkis to creating new issues will be replaced with this # ## If not nil, links to creating new issues will be replaced with this
# ## Use placeholders: # ## Use placeholders:
# ## :project_id - GitLab project identifier # ## :project_id - GitLab project identifier
# ## :issues_tracker_id - Project Name or Id in external issue tracker # ## :issues_tracker_id - Project Name or Id in external issue tracker
......
...@@ -18,4 +18,16 @@ if File.exists?(aws_file) ...@@ -18,4 +18,16 @@ if File.exists?(aws_file)
config.fog_authenticated_url_expiration = 1 << 29 # optional time (in seconds) that authenticated urls will be valid. config.fog_authenticated_url_expiration = 1 << 29 # optional time (in seconds) that authenticated urls will be valid.
# when fog_public is false and provider is AWS or Google, defaults to 600 # when fog_public is false and provider is AWS or Google, defaults to 600
end end
# Mocking Fog requests, based on: https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Test-Fog-based-uploaders
if Rails.env.test?
Fog.mock!
connection = ::Fog::Storage.new(
:aws_access_key_id => AWS_CONFIG['access_key_id'],
:aws_secret_access_key => AWS_CONFIG['secret_access_key'],
:provider => 'AWS',
:region => AWS_CONFIG['region']
)
connection.directories.create(:key => AWS_CONFIG['bucket'])
end
end end
...@@ -187,7 +187,9 @@ Gitlab::Application.routes.draw do ...@@ -187,7 +187,9 @@ Gitlab::Application.routes.draw do
resources :blob, only: [:show, :destroy], constraints: {id: /.+/} resources :blob, only: [:show, :destroy], constraints: {id: /.+/}
resources :raw, only: [:show], constraints: {id: /.+/} resources :raw, only: [:show], constraints: {id: /.+/}
resources :tree, only: [:show], constraints: {id: /.+/, format: /(html|js)/ } resources :tree, only: [:show], constraints: {id: /.+/, format: /(html|js)/ }
resources :edit_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'edit' resources :edit_tree, only: [:show, :update], constraints: { id: /.+/ }, path: 'edit' do
post :preview, on: :member
end
resources :new_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'new' resources :new_tree, only: [:show, :update], constraints: {id: /.+/}, path: 'new'
resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/} resources :commit, only: [:show], constraints: {id: /[[:alnum:]]{6,40}/}
resources :commits, only: [:show], constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} resources :commits, only: [:show], constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/}
......
require_relative 'limits_to_mysql'
class AddIndexOnIid < ActiveRecord::Migration
def change
RemoveDuplicateIid.clean(Issue)
RemoveDuplicateIid.clean(MergeRequest, 'target_project_id')
RemoveDuplicateIid.clean(Milestone)
add_index :issues, [:project_id, :iid], unique: true
add_index :merge_requests, [:target_project_id, :iid], unique: true
add_index :milestones, [:project_id, :iid], unique: true
end
end
class RemoveDuplicateIid
def self.clean(klass, project_field = 'project_id')
duplicates = klass.find_by_sql("SELECT iid, #{project_field} FROM #{klass.table_name} GROUP BY #{project_field}, iid HAVING COUNT(*) > 1")
duplicates.each do |duplicate|
project_id = duplicate.send(project_field)
iid = duplicate.iid
items = klass.of_projects(project_id).where(iid: iid)
if items.size > 1
puts "Remove #{klass.name} duplicates for iid: #{iid} and project_id: #{project_id}"
items.shift
items.each do |item|
item.destroy
puts '.'
end
end
end
end
end
class AddNotesIndexUpdatedAt < ActiveRecord::Migration
def change
add_index :notes, :updated_at
end
end
class AddRepoSizeToDb < ActiveRecord::Migration
def change
add_column :projects, :repository_size, :float, default: 0
end
end
class MigrateRepoSize < ActiveRecord::Migration
def up
Project.reset_column_information
Project.find_each(batch_size: 500) do |project|
begin
if project.empty_repo?
print '-'
else
project.update_repository_size
print '.'
end
rescue
print 'F'
end
end
puts 'Done'
end
def down
end
end
class LimitsToMysql < ActiveRecord::Migration
def up
return unless ActiveRecord::Base.configurations[Rails.env]['adapter'] =~ /^mysql/
change_column :merge_request_diffs, :st_commits, :text, limit: 2147483647
change_column :merge_request_diffs, :st_diffs, :text, limit: 2147483647
change_column :snippets, :content, :text, limit: 2147483647
change_column :notes, :st_diff, :text, limit: 2147483647
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140416185734) do ActiveRecord::Schema.define(version: 20140502125220) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -93,6 +93,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do ...@@ -93,6 +93,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do
add_index "issues", ["author_id"], name: "index_issues_on_author_id", using: :btree add_index "issues", ["author_id"], name: "index_issues_on_author_id", using: :btree
add_index "issues", ["created_at"], name: "index_issues_on_created_at", using: :btree add_index "issues", ["created_at"], name: "index_issues_on_created_at", using: :btree
add_index "issues", ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree add_index "issues", ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree
add_index "issues", ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true, using: :btree
add_index "issues", ["project_id"], name: "index_issues_on_project_id", using: :btree add_index "issues", ["project_id"], name: "index_issues_on_project_id", using: :btree
add_index "issues", ["title"], name: "index_issues_on_title", using: :btree add_index "issues", ["title"], name: "index_issues_on_title", using: :btree
...@@ -143,6 +144,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do ...@@ -143,6 +144,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do
add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree
add_index "merge_requests", ["source_project_id"], name: "index_merge_requests_on_source_project_id", using: :btree add_index "merge_requests", ["source_project_id"], name: "index_merge_requests_on_source_project_id", using: :btree
add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree
add_index "merge_requests", ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid", unique: true, using: :btree
add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree
create_table "milestones", force: true do |t| create_table "milestones", force: true do |t|
...@@ -157,6 +159,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do ...@@ -157,6 +159,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do
end end
add_index "milestones", ["due_date"], name: "index_milestones_on_due_date", using: :btree add_index "milestones", ["due_date"], name: "index_milestones_on_due_date", using: :btree
add_index "milestones", ["project_id", "iid"], name: "index_milestones_on_project_id_and_iid", unique: true, using: :btree
add_index "milestones", ["project_id"], name: "index_milestones_on_project_id", using: :btree add_index "milestones", ["project_id"], name: "index_milestones_on_project_id", using: :btree
create_table "namespaces", force: true do |t| create_table "namespaces", force: true do |t|
...@@ -197,6 +200,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do ...@@ -197,6 +200,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do
add_index "notes", ["noteable_type"], name: "index_notes_on_noteable_type", using: :btree add_index "notes", ["noteable_type"], name: "index_notes_on_noteable_type", using: :btree
add_index "notes", ["project_id", "noteable_type"], name: "index_notes_on_project_id_and_noteable_type", using: :btree add_index "notes", ["project_id", "noteable_type"], name: "index_notes_on_project_id_and_noteable_type", using: :btree
add_index "notes", ["project_id"], name: "index_notes_on_project_id", using: :btree add_index "notes", ["project_id"], name: "index_notes_on_project_id", using: :btree
add_index "notes", ["updated_at"], name: "index_notes_on_updated_at", using: :btree
create_table "projects", force: true do |t| create_table "projects", force: true do |t|
t.string "name" t.string "name"
...@@ -218,6 +222,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do ...@@ -218,6 +222,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do
t.integer "visibility_level", default: 0, null: false t.integer "visibility_level", default: 0, null: false
t.boolean "archived", default: false, null: false t.boolean "archived", default: false, null: false
t.string "import_status" t.string "import_status"
t.float "repository_size", default: 0.0
end end
add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree
...@@ -319,7 +324,6 @@ ActiveRecord::Schema.define(version: 20140416185734) do ...@@ -319,7 +324,6 @@ ActiveRecord::Schema.define(version: 20140416185734) do
t.integer "notification_level", default: 1, null: false t.integer "notification_level", default: 1, null: false
t.datetime "password_expires_at" t.datetime "password_expires_at"
t.integer "created_by_id" t.integer "created_by_id"
t.datetime "last_credential_check_at"
t.string "avatar" t.string "avatar"
t.string "confirmation_token" t.string "confirmation_token"
t.datetime "confirmed_at" t.datetime "confirmed_at"
...@@ -327,6 +331,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do ...@@ -327,6 +331,7 @@ ActiveRecord::Schema.define(version: 20140416185734) do
t.string "unconfirmed_email" t.string "unconfirmed_email"
t.boolean "hide_no_ssh_key", default: false t.boolean "hide_no_ssh_key", default: false
t.string "website_url", default: "", null: false t.string "website_url", default: "", null: false
t.datetime "last_credential_check_at"
end end
add_index "users", ["admin"], name: "index_users_on_admin", using: :btree add_index "users", ["admin"], name: "index_users_on_admin", using: :btree
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
+ [Merge Requests](merge_requests.md) + [Merge Requests](merge_requests.md)
+ [Issues](issues.md) + [Issues](issues.md)
+ [Milestones](milestones.md) + [Milestones](milestones.md)
+ [Notes](notes.md) + [Notes](notes.md) (comments)
+ [Deploy Keys](deploy_keys.md) + [Deploy Keys](deploy_keys.md)
+ [System Hooks](system_hooks.md) + [System Hooks](system_hooks.md)
+ [Groups](groups.md) + [Groups](groups.md)
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
+ [Ruby Wrapper](https://github.com/NARKOZ/gitlab) - Ruby + [Ruby Wrapper](https://github.com/NARKOZ/gitlab) - Ruby
+ [python-gitlab](https://github.com/Itxaka/python-gitlab) - Python + [python-gitlab](https://github.com/Itxaka/python-gitlab) - Python
+ [java-gitlab-api](https://github.com/timols/java-gitlab-api) - Java + [java-gitlab-api](https://github.com/timols/java-gitlab-api) - Java
+ [node-gitlab](https://github.com/moul/node-gitlab) - Node.js
## Introduction ## Introduction
......
...@@ -193,3 +193,7 @@ Parameters: ...@@ -193,3 +193,7 @@ Parameters:
+ `id` (required) - The project ID + `id` (required) - The project ID
+ `issue_id` (required) - The ID of the issue + `issue_id` (required) - The ID of the issue
## Comments on issues
Comments are done via the notes resource.
...@@ -258,3 +258,7 @@ Parameters: ...@@ -258,3 +258,7 @@ Parameters:
} }
] ]
``` ```
## Comments on issues
Comments are done via the notes resource.
Notes can be wall notes or comments on snippets, issues or merge requests.
## Wall ## Wall
### List project wall notes ### List project wall notes
......
+ [Architecture](architecture.md) ## Development
+ [Shell commands](shell_commands.md)
+ [Architecture](architecture.md) of GitLab
+ [Shell commands](shell_commands.md) in the GitLab codebase
+ [Rake tasks](rake_tasks.md) for development
# Rake tasks for developers
## Setup db with developer seeds:
Note that if your db user does not have advanced privilegies you must create db manually before run this command
```
bundle exec rake setup
```
## Run tests
This runs all test suite present in GitLab
```
bundle exec rake test
```
## Generate searchable docs for source code
You can find results under `doc/code` directory
```
bundle exec rake gitlab:generate_docs
```
...@@ -27,10 +27,9 @@ The GitLab installation consists of setting up the following components: ...@@ -27,10 +27,9 @@ The GitLab installation consists of setting up the following components:
1. Packages / Dependencies 1. Packages / Dependencies
2. Ruby 2. Ruby
3. System Users 3. System Users
4. GitLab shell 4. Database
5. Database 5. GitLab
6. GitLab 6. Nginx
7. Nginx
# 1. Packages / Dependencies # 1. Packages / Dependencies
...@@ -119,30 +118,7 @@ Create a `git` user for Gitlab: ...@@ -119,30 +118,7 @@ Create a `git` user for Gitlab:
sudo adduser --disabled-login --gecos 'GitLab' git sudo adduser --disabled-login --gecos 'GitLab' git
# 4. Database
# 4. GitLab shell
GitLab Shell is an ssh access and repository management software developed specially for GitLab.
# Go to home directory
cd /home/git
# Clone gitlab shell
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.3
cd gitlab-shell
sudo -u git -H cp config.yml.example config.yml
# Edit config and replace gitlab_url
# with something like 'http://domain.com/'
sudo -u git -H editor config.yml
# Do setup
sudo -u git -H ./bin/install
# 5. Database
We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](database_mysql.md). We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](database_mysql.md).
...@@ -165,7 +141,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da ...@@ -165,7 +141,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
sudo -u git -H psql -d gitlabhq_production sudo -u git -H psql -d gitlabhq_production
# 6. GitLab # 5. GitLab
# We'll install GitLab into home directory of the user "git" # We'll install GitLab into home directory of the user "git"
cd /home/git cd /home/git
...@@ -276,6 +252,18 @@ that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. ...@@ -276,6 +252,18 @@ that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2.
# When done you see 'Administrator account created:' # When done you see 'Administrator account created:'
## Install GitLab shell
GitLab Shell is an ssh access and repository management software developed specially for GitLab.
# Go to the Gitlab installation folder:
cd /home/git/gitlab
# Run the installation task for gitlab-shell (replace `REDIS_URL` if needed):
sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.3] REDIS_URL=redis://localhost:6379
# By default, the gitlab-shell config is generated from your main gitlab config. You can review (and modify) it as follows:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
## Install Init Script ## Install Init Script
...@@ -313,7 +301,13 @@ Check if GitLab and its environment are configured correctly: ...@@ -313,7 +301,13 @@ Check if GitLab and its environment are configured correctly:
# or # or
sudo /etc/init.d/gitlab restart sudo /etc/init.d/gitlab restart
# 7. Nginx
## Compile assets
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
# 6. Nginx
**Note:** **Note:**
Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the
......
...@@ -6,3 +6,4 @@ See the documentation below for details on how to configure these services. ...@@ -6,3 +6,4 @@ See the documentation below for details on how to configure these services.
+ [External issue tracker](external-issue-tracker.md) Redmine, JIRA, etc. + [External issue tracker](external-issue-tracker.md) Redmine, JIRA, etc.
+ [LDAP](ldap.md) Set up sign in via LDAP + [LDAP](ldap.md) Set up sign in via LDAP
+ [OmniAuth](omniauth.md) Sign in via Twitter, GitHub, and Google via OAuth. + [OmniAuth](omniauth.md) Sign in via Twitter, GitHub, and Google via OAuth.
+ [Slack](slack.md) Integrate with the Slack chat service
...@@ -27,7 +27,7 @@ If a user is a GitLab administrator they receive all permissions. ...@@ -27,7 +27,7 @@ If a user is a GitLab administrator they receive all permissions.
|Remove protected branches| |||✓|✓| |Remove protected branches| |||✓|✓|
|Edit project| |||✓|✓| |Edit project| |||✓|✓|
|Add Deploy Keys to project| |||✓|✓| |Add Deploy Keys to project| |||✓|✓|
|Confiure Project Hooks| |||✓|✓| |Configure Project Hooks| |||✓|✓|
|Switch visibility level| ||||✓| |Switch visibility level| ||||✓|
|Transfer project to another namespace| ||||✓| |Transfer project to another namespace| ||||✓|
|Remove project| ||||✓| |Remove project| ||||✓|
......
+ [Backup restore](backup_restore.md) + [Backup restore](backup_restore.md)
+ [Cleanup](cleanup.md) + [Cleanup](cleanup.md)
+ [Features](features.md) + [Features](features.md)
+ [Maintenance](maintenance.md) + [Maintenance](maintenance.md) and self-checks
+ [User management](user_management.md) + [User management](user_management.md)
+ [Web hooks](web_hooks.md) + [Web hooks](web_hooks.md)
+ [Import](import.md) of git repositories in bulk
### Import bare repositories into GitLab project instance
Notes:
* project owner will be a first admin
* groups will be created as needed
* group owner will be the first admin
* existing projects will be skipped
How to use:
1. copy your bare repos under git repos_path (see `config/gitlab.yml` gitlab_shell -> repos_path)
2. run the command below
```
bundle exec rake gitlab:import:repos RAILS_ENV=production
```
Example output:
```
Processing abcd.git
* Created abcd (abcd.git)
Processing group/xyz.git
* Created Group group (2)
* Created xyz (group/xyz.git)
[...]
```
...@@ -110,32 +110,3 @@ If necessary, remove the `tmp/repo_satellites` directory and rerun the command b ...@@ -110,32 +110,3 @@ If necessary, remove the `tmp/repo_satellites` directory and rerun the command b
``` ```
bundle exec rake gitlab:satellites:create RAILS_ENV=production bundle exec rake gitlab:satellites:create RAILS_ENV=production
``` ```
### Import bare repositories into GitLab project instance
Notes:
* project owner will be a first admin
* groups will be created as needed
* group owner will be the first admin
* existing projects will be skipped
How to use:
1. copy your bare repos under git repos_path (see `config/gitlab.yml` gitlab_shell -> repos_path)
2. run the command below
```
bundle exec rake gitlab:import:repos RAILS_ENV=production
```
Example output:
```
Processing abcd.git
* Created abcd (abcd.git)
Processing group/xyz.git
* Created Group group (2)
* Created xyz (group/xyz.git)
[...]
```
...@@ -122,7 +122,6 @@ It is important to do this as soon as possible, so we can catch any errors befor ...@@ -122,7 +122,6 @@ It is important to do this as soon as possible, so we can catch any errors befor
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: 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. Create x-x-stable branch and push to the repositories** ### **1. Create x-x-stable branch and push to the repositories**
``` ```
......
# From 6.0 to 6.7 # From 6.0 to 6.8
# In 6.1 we remove a lot of deprecated code. # In 6.1 we remove a lot of deprecated code.
# You should update to 6.0 before installing 6.1 or higher so all the necessary conversions are run. # You should update to 6.0 before installing 6.1 or higher so all the necessary conversions are run.
...@@ -33,7 +33,7 @@ sudo -u git -H git fetch --all ...@@ -33,7 +33,7 @@ sudo -u git -H git fetch --all
For Gitlab Community Edition: For Gitlab Community Edition:
```bash ```bash
sudo -u git -H git checkout 6-7-stable sudo -u git -H git checkout 6-8-stable
``` ```
OR OR
...@@ -41,7 +41,7 @@ OR ...@@ -41,7 +41,7 @@ OR
For GitLab Enterprise Edition: For GitLab Enterprise Edition:
```bash ```bash
sudo -u git -H git checkout 6-7-stable-ee sudo -u git -H git checkout 6-8-stable-ee
``` ```
...@@ -57,7 +57,7 @@ sudo apt-get install logrotate ...@@ -57,7 +57,7 @@ sudo apt-get install logrotate
```bash ```bash
cd /home/git/gitlab-shell cd /home/git/gitlab-shell
sudo -u git -H git fetch sudo -u git -H git fetch
sudo -u git -H git checkout v1.9.1 # Addresses multiple critical security vulnerabilities sudo -u git -H git checkout v1.9.3 # Addresses multiple critical security vulnerabilities
``` ```
### 5. Install libs, migrations, etc. ### 5. Install libs, migrations, etc.
...@@ -90,11 +90,12 @@ sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites ...@@ -90,11 +90,12 @@ sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites
TIP: to see what changed in gitlab.yml.example in this release use next command: TIP: to see what changed in gitlab.yml.example in this release use next command:
``` ```
git diff 6-0-stable:config/gitlab.yml.example 6-7-stable:config/gitlab.yml.example git diff 6-0-stable:config/gitlab.yml.example 6-8-stable:config/gitlab.yml.example
``` ```
* Make `/home/git/gitlab/config/gitlab.yml` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-7-stable/config/gitlab.yml.example but with your settings. * Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/config/gitlab.yml.example but with your settings.
* Make `/home/git/gitlab/config/unicorn.rb` same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-7-stable/config/unicorn.rb.example but with your settings. * Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/config/unicorn.rb.example but with your settings.
* Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/6-8-stable/lib/support/nginx/gitlab but with your settings.
* Copy rack attack middleware config * Copy rack attack middleware config
```bash ```bash
......
...@@ -62,6 +62,7 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS ...@@ -62,6 +62,7 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS
# Update init.d script # Update init.d script
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab 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) # Update the logrotate configuration (keep logs for 90 days instead of 52 weeks)
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
...@@ -92,19 +93,12 @@ If you are using HTTPS, disable gzip as in [this commit](https://gitlab.com/gitl ...@@ -92,19 +93,12 @@ If you are using HTTPS, disable gzip as in [this commit](https://gitlab.com/gitl
To improve performance, enable gzip asset compression as seen [in this commit](https://gitlab.com/gitlab-org/gitlab-ce/commit/8af94ed75505f0253823b9b2d44320fecea5b5fb). To improve performance, enable gzip asset compression as seen [in this commit](https://gitlab.com/gitlab-org/gitlab-ce/commit/8af94ed75505f0253823b9b2d44320fecea5b5fb).
### 6. Update Init script ### 6. Start application
```bash
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab
```
### 7. Start application
sudo service gitlab start sudo service gitlab start
sudo service nginx restart sudo service nginx restart
### 8. Check application status ### 7. Check application status
Check if GitLab and its environment are configured correctly: Check if GitLab and its environment are configured correctly:
......
...@@ -2,16 +2,16 @@ Project web hooks allow you to trigger an URL if new code is pushed or a new iss ...@@ -2,16 +2,16 @@ Project web hooks allow you to trigger an URL if new code is pushed or a new iss
--- ---
You can configure web hook to listen for specific events like pushes, issues, merge requests. You can configure web hooks to listen for specific events like pushes, issues or merge requests.
GitLab will send POST request with data to web hook URL. GitLab will send a POST request with data to the web hook URL.
Web Hooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server. Web hooks can be used to update an external issue tracker, trigger CI builds, update a backup mirror, or even deploy to your production server.
If you send a web hook to an SSL endpoint [the certificate will not be verified](https://gitlab.com/gitlab-org/gitlab-ce/blob/ccd617e58ea71c42b6b073e692447d0fe3c00be6/app/models/web_hook.rb#L35) since many people use self-signed certificates. If you send a web hook to an SSL endpoint [the certificate will not be verified](https://gitlab.com/gitlab-org/gitlab-ce/blob/ccd617e58ea71c42b6b073e692447d0fe3c00be6/app/models/web_hook.rb#L35) since many people use self-signed certificates.
--- ---
#### Push events #### Push events
Triggered when you push to the repository except pushing tags. Triggered when you push to the repository except when pushing tags.
**Request body:** **Request body:**
...@@ -84,7 +84,7 @@ Triggered when a new issue is created or an existing issue was updated/closed/re ...@@ -84,7 +84,7 @@ Triggered when a new issue is created or an existing issue was updated/closed/re
#### Merge request events #### Merge request events
Triggered when a new merge request is created or an existing merge request was updated/merges/closed. Triggered when a new merge request is created or an existing merge request was updated/merged/closed.
**Request body:** **Request body:**
......
...@@ -29,3 +29,13 @@ Feature: Project Browse files ...@@ -29,3 +29,13 @@ Feature: Project Browse files
Given I click on "Gemfile.lock" file in repo Given I click on "Gemfile.lock" file in repo
And I click button "edit" And I click button "edit"
Then I can edit code Then I can edit code
@javascript
Scenario: I can see editing preview
Given I click on "Gemfile.lock" file in repo
And I click button "edit"
And I edit code
And I click link "Diff"
Then I see diff
...@@ -41,6 +41,18 @@ class ProjectBrowseFiles < Spinach::FeatureSteps ...@@ -41,6 +41,18 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
page.evaluate_script('editor.getValue()').should == "GitlabFileEditor" page.evaluate_script('editor.getValue()').should == "GitlabFileEditor"
end end
step 'I edit code' do
page.execute_script('editor.setValue("GitlabFileEditor")')
end
step 'I click link "Diff"' do
click_link 'Diff'
end
step 'I see diff' do
page.should have_css '.line_holder.new'
end
step 'I click on "new file" link in repo' do step 'I click on "new file" link in repo' do
click_link 'new-file-link' click_link 'new-file-link'
end end
......
...@@ -4,9 +4,9 @@ module Gitlab ...@@ -4,9 +4,9 @@ module Gitlab
attr_reader :lines, :new_path attr_reader :lines, :new_path
def initialize(diff) def initialize(lines, new_path = '')
@lines = diff.diff.lines.to_a @lines = lines
@new_path = diff.new_path @new_path = new_path
end end
def each def each
...@@ -18,10 +18,7 @@ module Gitlab ...@@ -18,10 +18,7 @@ module Gitlab
lines_arr.each do |line| lines_arr.each do |line|
raw_line = line.dup raw_line = line.dup
next if line.match(/^\-\-\- \/dev\/null/) next if filename?(line)
next if line.match(/^\+\+\+ \/dev\/null/)
next if line.match(/^\-\-\- a/)
next if line.match(/^\+\+\+ b/)
full_line = html_escape(line.gsub(/\n/, '')) full_line = html_escape(line.gsub(/\n/, ''))
full_line = ::Gitlab::InlineDiff.replace_markers full_line full_line = ::Gitlab::InlineDiff.replace_markers full_line
...@@ -53,8 +50,17 @@ module Gitlab ...@@ -53,8 +50,17 @@ module Gitlab
end end
end end
def empty?
@lines.empty?
end
private private
def filename?(line)
line.start_with?('--- /dev/null', '+++ /dev/null', '--- a', '+++ b',
'--- /tmp/diffy', '+++ /tmp/diffy')
end
def identification_type(line) def identification_type(line)
if line[0] == "+" if line[0] == "+"
"new" "new"
......
...@@ -44,7 +44,8 @@ module Gitlab ...@@ -44,7 +44,8 @@ module Gitlab
def users(field, value) def users(field, value)
if field.to_sym == :dn if field.to_sym == :dn
options = { options = {
base: value base: value,
scope: Net::LDAP::SearchScope_BaseObject
} }
else else
options = { options = {
......
...@@ -15,14 +15,7 @@ namespace :gitlab do ...@@ -15,14 +15,7 @@ namespace :gitlab do
end end
Rake::Task["db:setup"].invoke Rake::Task["db:setup"].invoke
Rake::Task["add_limits_mysql"].invoke
config = YAML.load_file(File.join(Rails.root,'config','database.yml'))[Rails.env]
success = case config["adapter"]
when /^mysql/ then
Rake::Task["add_limits_mysql"].invoke
when "postgresql" then
end
Rake::Task["db:seed_fu"].invoke Rake::Task["db:seed_fu"].invoke
rescue Gitlab::TaskAbortedByUserError rescue Gitlab::TaskAbortedByUserError
puts "Quitting...".red puts "Quitting...".red
......
namespace :gitlab do namespace :gitlab do
namespace :shell do namespace :shell do
desc "GITLAB | Install or upgrade gitlab-shell"
task :install, [:tag, :repo] => :environment do |t, args|
warn_user_is_not_gitlab
args.with_defaults(tag: "v1.9.3", repo: "https://gitlab.com/gitlab-org/gitlab-shell.git")
user = Settings.gitlab.user
home_dir = Settings.gitlab.user_home
gitlab_url = Settings.gitlab.url
# gitlab-shell requires a / at the end of the url
gitlab_url += "/" unless gitlab_url.match(/\/$/)
repos_path = Gitlab.config.gitlab_shell.repos_path
target_dir = Gitlab.config.gitlab_shell.path
# Clone if needed
unless File.directory?(target_dir)
sh "git clone '#{args.repo}' '#{target_dir}'"
end
# Make sure we're on the right tag
Dir.chdir(target_dir) do
sh "git fetch origin && git reset --hard $(git describe #{args.tag} || git describe origin/#{args.tag})"
redis_url = URI.parse(ENV['REDIS_URL'] || "redis://localhost:6379")
config = {
user: user,
gitlab_url: gitlab_url,
http_settings: {self_signed_cert: false}.stringify_keys,
repos_path: repos_path,
auth_file: File.join(home_dir, ".ssh", "authorized_keys"),
redis: {
bin: %x{which redis-cli}.chomp,
host: redis_url.host,
port: redis_url.port,
namespace: "resque:gitlab"
}.stringify_keys,
log_level: "INFO",
audit_usernames: false
}.stringify_keys
# Generate config.yml based on existing gitlab settings
File.open("config.yml", "w+") {|f| f.puts config.to_yaml}
# Launch installation process
sh "bin/install"
end
# Required for debian packaging with PKGR: Setup .ssh/environment with
# the current PATH, so that the correct ruby version gets loaded
# Requires to set "PermitUserEnvironment yes" in sshd config (should not
# be an issue since it is more than likely that there are no "normal"
# user accounts on a gitlab server). The alternative is for the admin to
# install a ruby (1.9.3+) in the global path.
File.open(File.join(home_dir, ".ssh", "environment"), "w+") do |f|
f.puts "PATH=#{ENV['PATH']}"
end
end
desc "GITLAB | Setup gitlab-shell" desc "GITLAB | Setup gitlab-shell"
task setup: :environment do task setup: :environment do
setup setup
......
require Rails.root.join('db/migrate/limits_to_mysql')
desc "GITLAB | Add limits to strings in mysql database" desc "GITLAB | Add limits to strings in mysql database"
task add_limits_mysql: :environment do task add_limits_mysql: :environment do
puts "Adding limits to schema.rb for mysql" puts "Adding limits to schema.rb for mysql"
LimitsToMysql.new.up LimitsToMysql.new.up
end end
class LimitsToMysql < ActiveRecord::Migration
def up
change_column :merge_request_diffs, :st_commits, :text, limit: 2147483647
change_column :merge_request_diffs, :st_diffs, :text, limit: 2147483647
change_column :snippets, :content, :text, limit: 2147483647
change_column :notes, :st_diff, :text, limit: 2147483647
end
end
desc "GITLAB | Setup gitlab db"
task :setup do
Rake::Task["gitlab:setup"].invoke
end
...@@ -2,7 +2,6 @@ body { ...@@ -2,7 +2,6 @@ body {
color: #666; color: #666;
text-align: center; text-align: center;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
sans-serif;
margin:0; margin:0;
width: 800px; width: 800px;
margin: auto; margin: auto;
......
require 'spec_helper'
describe NotesFinder do
let(:user) { create :user }
let(:project) { create :project }
let(:note1) { create :note_on_commit, project: project }
let(:note2) { create :note_on_commit, project: project }
let(:commit) { note1.noteable }
before do
project.team << [user, :master]
end
describe :execute do
let(:params) { { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago.to_i } }
before do
note1
note2
end
it 'should find all notes' do
notes = NotesFinder.new.execute(project, user, params)
notes.size.should eq(2)
end
it 'should raise an exception for an invalid target_type' do
params.merge!(target_type: 'invalid')
expect { NotesFinder.new.execute(project, user, params) }.to raise_error('invalid target_type')
end
it 'filters out old notes' do
note2.update_attribute(:updated_at, 2.hours.ago)
notes = NotesFinder.new.execute(project, user, params)
notes.should eq([note1])
end
end
end
...@@ -46,7 +46,7 @@ describe ApplicationHelper do ...@@ -46,7 +46,7 @@ describe ApplicationHelper do
group = create(:group) group = create(:group)
group.avatar = File.open(avatar_file_path) group.avatar = File.open(avatar_file_path)
group.save! group.save!
group_icon(group.path).to_s.should == "/uploads/group/avatar/#{ group.id }/gitlab_logo.png" group_icon(group.path).to_s.should match("/uploads/group/avatar/#{ group.id }/gitlab_logo.png")
end end
it "should give default avatar_icon when no avatar is present" do it "should give default avatar_icon when no avatar is present" do
...@@ -63,7 +63,7 @@ describe ApplicationHelper do ...@@ -63,7 +63,7 @@ describe ApplicationHelper do
user = create(:user) user = create(:user)
user.avatar = File.open(avatar_file_path) user.avatar = File.open(avatar_file_path)
user.save! user.save!
avatar_icon(user.email).to_s.should == "/uploads/user/avatar/#{ user.id }/gitlab_logo.png" avatar_icon(user.email).to_s.should match("/uploads/user/avatar/#{ user.id }/gitlab_logo.png")
end end
it "should call gravatar_icon when no avatar is present" do it "should call gravatar_icon when no avatar is present" do
......
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