Commit ea2a57cd authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge branch 'improve/compare_page' into 'master'

Improve Compare page

Prevent Compare page timout for large amount of commits.
Fixes #989
v 6.6.0
- Permissions: Developer now can manage issue tracker (modify any issue)
- Improve Code Compare page performance
v 6.5.1
- Fix branch selectbox when create merge request from fork
......
......@@ -23,6 +23,12 @@
}
}
&.warning-row {
background-color: #fcf8e3;
border-color: #faebcc;
color: #8a6d3b;
}
&.smoke { background-color: #f5f5f5; }
&:hover {
......
......@@ -8,7 +8,7 @@ def index
end
def show
compare = Gitlab::Git::Compare.new(@repository.raw_repository, params[:from], params[:to])
compare = Gitlab::Git::Compare.new(@repository.raw_repository, params[:from], params[:to], MergeRequestDiff::COMMITS_SAFE_SIZE)
@commits = compare.commits
@commit = compare.commit
......@@ -16,6 +16,11 @@ def show
@refs_are_same = compare.same
@line_notes = []
if @diffs == [Gitlab::Git::Diff::BROKEN_DIFF]
@diffs = []
@timeout = true
end
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)
......
......@@ -14,7 +14,7 @@
 
= submit_tag "Compare", class: "btn btn-create commits-compare-btn"
- if compare_to_mr_button?
= link_to compare_mr_path, class: 'prepend-left-10' do
= link_to compare_mr_path, class: 'prepend-left-10 btn' do
%strong Make a merge request
......
......@@ -5,21 +5,32 @@
= render "form"
- if @commits.size > 100
.alert.alert-warning
%p
%strong Warning! This comparison includes more than 100 commits.
%p To preserve performance the line diff is not shown.
- if @commits.present?
%div.ui-box
.title
Commits (#{@commits.count})
%ul.well-list= render Commit.decorate(@commits), project: @project
- if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
%ul.well-list
- Commit.decorate(@commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE)).each do |commit|
= render "projects/commits/inline_commit", commit: commit, project: @project
%li.warning-row.unstyled
other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues.
- else
%ul.well-list= render Commit.decorate(@commits), project: @project
- unless @diffs.empty?
%h4 Diff
%h4 Diff
- 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 diff is not shown.
- elsif @timeout
.bs-callout.bs-callout-danger
%h4 Diff for this comparison is extremely large.
%p Use command line to browse diff for this comparison.
- else
.light-well
%center
......
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