Skip to content
Snippets Groups Projects
Commit 8c65cc47 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang
Browse files

Added Annotate/Blame view for Subversion, CVS and Mercurial repositories.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@947 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent e4724c76
Branches
Tags
No related merge requests found
......@@ -95,6 +95,11 @@ class RepositoriesController < ApplicationController
end
end
def annotate
@annotate = @repository.scm.annotate(@path, @rev)
show_error and return if @annotate.nil? || @annotate.empty?
end
def revision
@changeset = @repository.changesets.find_by_revision(@rev)
raise ChangesetNotFound unless @changeset
......
......@@ -33,6 +33,10 @@ class Repository < ActiveRecord::Base
def supports_cat?
scm.supports_cat?
end
def supports_annotate?
scm.supports_annotate?
end
def entries(path=nil, identifier=nil)
scm.entries(path, identifier)
......
<h2><%= render :partial => 'navigation', :locals => { :path => @path, :kind => 'file', :revision => @rev } %></h2>
<% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
<div class="autoscroll">
<table class="filecontent annotate CodeRay">
<tbody>
<% line_num = 1 %>
<% syntax_highlight(@path, to_utf8(@annotate.content)).each_line do |line| %>
<% revision = @annotate.revisions[line_num-1] %>
<tr class="bloc-<%= revision.nil? ? 0 : colors[revision.identifier || revision.revision] %>">
<th class="line-num"><%= line_num %></th>
<td class="revision">
<%= (revision.identifier ? link_to(revision.identifier, :action => 'revision', :id => @project, :rev => revision.identifier) : revision.revision) if revision %></td>
<td class="author"><%= h(revision.author) if revision %></td>
<td class="line-code"><pre><%= line %></pre></td>
</tr>
<% line_num += 1 %>
<% end %>
<tbody>
</table>
</div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
......@@ -2,14 +2,17 @@
<h3><%=h @entry.name %></h3>
<% if @repository.supports_cat? %>
<p>
<% if @entry.is_text? %>
<%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
<% if @repository.supports_cat? %>
<%= link_to l(:button_view), {:action => 'entry', :id => @project, :path => @path, :rev => @rev } %> |
<% end %>
<% if @repository.supports_annotate? %>
<%= link_to l(:button_annotate), {:action => 'annotate', :id => @project, :path => @path, :rev => @rev } %> |
<% end %>
<% end %>
<%= link_to l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' } %>
<%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %>
<%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
</p>
<% end %>
<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }%>
......@@ -2,11 +2,6 @@
<div class="autoscroll">
<table class="filecontent CodeRay">
<thead>
<tr>
<th colspan="2" class="filename"><%= @path %></th>
</tr>
</thead>
<tbody>
<% line_num = 1 %>
<% syntax_highlight(@path, to_utf8(@content)).each_line do |line| %>
......
......@@ -24,6 +24,7 @@ ActionController::Routing::Routes.draw do |map|
omap.repositories_changes 'repositories/changes/:id/*path', :action => 'changes'
omap.repositories_diff 'repositories/diff/:id/*path', :action => 'diff'
omap.repositories_entry 'repositories/entry/:id/*path', :action => 'entry'
omap.repositories_entry 'repositories/annotate/:id/*path', :action => 'annotate'
end
# Allow downloading Web Service WSDL as a file with an extension
......
......@@ -547,3 +547,4 @@ notice_account_pending: "Your account was created and is now pending administrat
field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -547,3 +547,4 @@ notice_account_pending: "Your account was created and is now pending administrat
field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -547,3 +547,4 @@ notice_account_pending: "Ihr Konto wurde erstellt und wartet jetzt auf die Geneh
field_time_zone: Zeitzone
text_caracters_minimum: Muss mindestens %d Zeichen lang sein.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -489,6 +489,7 @@ button_reset: Reset
button_rename: Rename
button_change_password: Change password
button_copy: Copy
button_annotate: Annotate
status_active: active
status_registered: registered
......
......@@ -550,3 +550,4 @@ label_registration_manual_activation: activación manual de cuenta
notice_account_pending: "Su cuenta ha sido creada y está pendiende de la aprobación por parte de administrador"
setting_time_format: Formato de hora
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -489,6 +489,7 @@ button_reset: Réinitialiser
button_rename: Renommer
button_change_password: Changer de mot de passe
button_copy: Copier
button_annotate: Annoter
status_active: actif
status_registered: enregistré
......
......@@ -547,3 +547,4 @@ notice_account_pending: "Your account was created and is now pending administrat
field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -547,3 +547,4 @@ notice_account_pending: "Your account was created and is now pending administrat
field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -548,3 +548,4 @@ notice_account_pending: "Your account was created and is now pending administrat
field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -547,3 +547,4 @@ notice_account_pending: "Your account was created and is now pending administrat
field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -548,3 +548,4 @@ notice_account_pending: "Your account was created and is now pending administrat
field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -547,3 +547,4 @@ notice_account_pending: "Twoje konto zostało utworzone i oczekuje na zatwierdze
field_time_zone: Strefa czasowa
text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -547,3 +547,4 @@ notice_account_pending: "Your account was created and is now pending administrat
field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
......@@ -547,3 +547,4 @@ notice_account_pending: "Your account was created and is now pending administrat
field_time_zone: Time zone
text_caracters_minimum: Must be at least %d characters long.
setting_bcc_recipients: Blind carbon copy recipients (bcc)
button_annotate: Annotate
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