Commit 67bfae0b authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 5e7e505f 26087322
...@@ -194,10 +194,9 @@ module IssuableCollections ...@@ -194,10 +194,9 @@ module IssuableCollections
end end
def collection_type def collection_type
@collection_type ||= case finder_type.name @collection_type ||= if finder_type <= IssuesFinder
when 'IssuesFinder'
'Issue' 'Issue'
when 'MergeRequestsFinder' elsif finder_type <= MergeRequestsFinder
'MergeRequest' 'MergeRequest'
end end
end end
......
...@@ -6,6 +6,7 @@ class List < ApplicationRecord ...@@ -6,6 +6,7 @@ class List < ApplicationRecord
belongs_to :board belongs_to :board
belongs_to :label belongs_to :label
include Importable
enum list_type: { backlog: 0, label: 1, closed: 2, assignee: 3, milestone: 4 } enum list_type: { backlog: 0, label: 1, closed: 2, assignee: 3, milestone: 4 }
......
...@@ -196,6 +196,12 @@ class MergeRequestDiff < ApplicationRecord ...@@ -196,6 +196,12 @@ class MergeRequestDiff < ApplicationRecord
real_size.presence || raw_diffs.size real_size.presence || raw_diffs.size
end end
def lines_count
strong_memoize(:lines_count) do
diffs.diff_files.sum(&:line_count)
end
end
def raw_diffs(options = {}) def raw_diffs(options = {})
if options[:ignore_whitespace_change] if options[:ignore_whitespace_change]
@diffs_no_whitespace ||= compare.diffs(options) @diffs_no_whitespace ||= compare.diffs(options)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
%li= _('Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities') %li= _('Issues with comments, merge requests with diffs and comments, labels, milestones, snippets, and other project entities')
%li= _('Issue Boards') %li= _('Issue Boards')
%li= _('LFS objects') %li= _('LFS objects')
%li= _('Issue Boards')
%p= _('The following items will NOT be exported:') %p= _('The following items will NOT be exported:')
%ul %ul
%li= _('Job traces and artifacts') %li= _('Job traces and artifacts')
......
# frozen_string_literal: true
class AddMrProductivityMetrics < ActiveRecord::Migration[5.1]
DOWNTIME = false
def change
add_column :merge_request_metrics, :first_comment_at, :datetime_with_timezone
add_column :merge_request_metrics, :first_commit_at, :datetime_with_timezone
add_column :merge_request_metrics, :last_commit_at, :datetime_with_timezone
add_column :merge_request_metrics, :diff_size, :integer
add_column :merge_request_metrics, :modified_paths_size, :integer
add_column :merge_request_metrics, :commits_count, :integer
end
end
...@@ -1979,6 +1979,12 @@ ActiveRecord::Schema.define(version: 2019_08_02_012622) do ...@@ -1979,6 +1979,12 @@ ActiveRecord::Schema.define(version: 2019_08_02_012622) do
t.integer "merged_by_id" t.integer "merged_by_id"
t.integer "latest_closed_by_id" t.integer "latest_closed_by_id"
t.datetime_with_timezone "latest_closed_at" t.datetime_with_timezone "latest_closed_at"
t.datetime_with_timezone "first_comment_at"
t.datetime_with_timezone "first_commit_at"
t.datetime_with_timezone "last_commit_at"
t.integer "diff_size"
t.integer "modified_paths_size"
t.integer "commits_count"
t.index ["first_deployed_to_production_at"], name: "index_merge_request_metrics_on_first_deployed_to_production_at" t.index ["first_deployed_to_production_at"], name: "index_merge_request_metrics_on_first_deployed_to_production_at"
t.index ["latest_closed_at"], name: "index_merge_request_metrics_on_latest_closed_at", where: "(latest_closed_at IS NOT NULL)" t.index ["latest_closed_at"], name: "index_merge_request_metrics_on_latest_closed_at", where: "(latest_closed_at IS NOT NULL)"
t.index ["latest_closed_by_id"], name: "index_merge_request_metrics_on_latest_closed_by_id" t.index ["latest_closed_by_id"], name: "index_merge_request_metrics_on_latest_closed_by_id"
......
...@@ -167,6 +167,14 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -167,6 +167,14 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect(GroupLabel.count).to eq(0) expect(GroupLabel.count).to eq(0)
end end
it 'has issue boards' do
expect(Project.find_by_path('project').boards.count).to eq(1)
end
it 'has lists associated with the issue board' do
expect(Project.find_by_path('project').boards.find_by_name('TestBoardABC').lists.count).to eq(3)
end
it 'has a project feature' do it 'has a project feature' do
expect(@project.project_feature).not_to be_nil expect(@project.project_feature).not_to be_nil
end end
......
...@@ -235,6 +235,12 @@ MergeRequest::Metrics: ...@@ -235,6 +235,12 @@ MergeRequest::Metrics:
- latest_build_started_at - latest_build_started_at
- latest_build_finished_at - latest_build_finished_at
- first_deployed_to_production_at - first_deployed_to_production_at
- first_comment_at
- first_commit_at
- last_commit_at
- diff_size
- modified_paths_size
- commits_count
Ci::Pipeline: Ci::Pipeline:
- id - id
- project_id - project_id
......
...@@ -484,4 +484,12 @@ describe MergeRequestDiff do ...@@ -484,4 +484,12 @@ describe MergeRequestDiff do
end end
end end
end end
describe '#lines_count' do
subject { diff_with_commits }
it 'returns sum of all changed lines count in diff files' do
expect(subject.lines_count).to eq 109
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