Commit fed202f6 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'grit_blame' into 'master'

Fast blame

Improve performance for file blame page. Also bring some small UI improvements

See merge request !1129
parents 43e15200 50b1f09a
...@@ -38,7 +38,7 @@ gem "browser", '~> 0.8.0' ...@@ -38,7 +38,7 @@ gem "browser", '~> 0.8.0'
# Extracting information from a git repository # Extracting information from a git repository
# Provide access to Gitlab::Git library # Provide access to Gitlab::Git library
gem "gitlab_git", '~> 7.2.11' gem "gitlab_git", '~> 7.2.12'
# Ruby/Rack Git Smart-HTTP Server Handler # Ruby/Rack Git Smart-HTTP Server Handler
# GitLab fork with a lot of changes (improved thread-safety, better memory usage etc) # GitLab fork with a lot of changes (improved thread-safety, better memory usage etc)
......
...@@ -271,7 +271,7 @@ GEM ...@@ -271,7 +271,7 @@ GEM
mime-types (~> 1.19) mime-types (~> 1.19)
gitlab_emoji (0.1.0) gitlab_emoji (0.1.0)
gemojione (~> 2.0) gemojione (~> 2.0)
gitlab_git (7.2.11) gitlab_git (7.2.12)
activesupport (~> 4.0) activesupport (~> 4.0)
charlock_holmes (~> 0.6) charlock_holmes (~> 0.6)
gitlab-linguist (~> 3.0) gitlab-linguist (~> 3.0)
...@@ -783,7 +783,7 @@ DEPENDENCIES ...@@ -783,7 +783,7 @@ DEPENDENCIES
gitlab-grack (~> 2.0.2) gitlab-grack (~> 2.0.2)
gitlab-linguist (~> 3.0.1) gitlab-linguist (~> 3.0.1)
gitlab_emoji (~> 0.1) gitlab_emoji (~> 0.1)
gitlab_git (~> 7.2.11) gitlab_git (~> 7.2.12)
gitlab_meta (= 7.0) gitlab_meta (= 7.0)
gitlab_omniauth-ldap (= 1.2.1) gitlab_omniauth-ldap (= 1.2.1)
gollum-lib (~> 4.0.2) gollum-lib (~> 4.0.2)
......
...@@ -90,12 +90,7 @@ ...@@ -90,12 +90,7 @@
border-right: none; border-right: none;
} }
background: #fff; background: #fff;
padding: 5px; padding: 8px;
}
.author,
.blame_commit {
background: $background-color;
vertical-align: top;
} }
.lines { .lines {
pre { pre {
......
...@@ -89,6 +89,10 @@ ...@@ -89,6 +89,10 @@
td.blame-commit { td.blame-commit {
background: #f9f9f9; background: #f9f9f9;
min-width: 350px; min-width: 350px;
.commit-author-link {
color: #888;
}
} }
td.blame-numbers { td.blame-numbers {
pre { pre {
......
...@@ -7,7 +7,7 @@ class Projects::BlameController < Projects::ApplicationController ...@@ -7,7 +7,7 @@ class Projects::BlameController < Projects::ApplicationController
before_action :authorize_download_code! before_action :authorize_download_code!
def show def show
@blob = @repository.blob_at(@commit.id, @path)
@blame = Gitlab::Git::Blame.new(@repository, @commit.id, @path) @blame = Gitlab::Git::Blame.new(@repository, @commit.id, @path)
@blob = @blame.blob
end end
end end
...@@ -12,25 +12,31 @@ ...@@ -12,25 +12,31 @@
= render "projects/blob/actions" = render "projects/blob/actions"
.file-content.blame.highlight .file-content.blame.highlight
%table %table
- @blame.each do |commit, lines, since| - current_line = 1
- commit = Commit.new(commit, @project) - @blame.each do |raw_commit, line|
%tr %tr
%td.blame-commit %td.blame-commit
%span.commit .commit
= link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "commit_short_id" - unless @prev_commit && @prev_commit.sha == raw_commit.sha
&nbsp; - commit = Commit.new(raw_commit, @project)
= commit_author_link(commit, avatar: true, size: 16) .commit-row-title
&nbsp; %strong
= link_to_gfm truncate(commit.title, length: 20), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "row_title" = link_to_gfm truncate(commit.title, length: 35), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "cdark"
.pull-right
= link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "monospace"
&nbsp;
.light
= commit_author_link(commit, avatar: false)
authored
#{time_ago_with_tooltip(commit.committed_date)}
- @prev_commit = raw_commit
%td.lines.blame-numbers %td.lines.blame-numbers
%pre %pre
- (since...(since + lines.count)).each do |i| = current_line
= i - current_line += 1
\
%td.lines %td.lines
%pre{class: 'code highlight white'} %pre{class: 'code highlight white'}
%code %code
:erb :erb
<% lines.each do |line| %> <%= highlight(@blob.name, line, nowrap: true, continue: true).html_safe %>
<%= highlight(@blob.name, line, nowrap: true, continue: true).html_safe %>
<% 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