diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index b332c72..dfd5d0a 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -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 diff --git a/app/models/repository.rb b/app/models/repository.rb index 35dd680..be31ac2 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -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) diff --git a/app/views/repositories/annotate.rhtml b/app/views/repositories/annotate.rhtml new file mode 100644 index 0000000..b8f481a --- /dev/null +++ b/app/views/repositories/annotate.rhtml @@ -0,0 +1,26 @@ +
<%= line_num %> | ++ <%= (revision.identifier ? link_to(revision.identifier, :action => 'revision', :id => @project, :rev => revision.identifier) : revision.revision) if revision %> | +<%= h(revision.author) if revision %> | +<%= line %> |
+
---|
<% 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 %>
-<% end %> <%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => @entry }%> diff --git a/app/views/repositories/entry.rhtml b/app/views/repositories/entry.rhtml index 94db240..9927601 100644 --- a/app/views/repositories/entry.rhtml +++ b/app/views/repositories/entry.rhtml @@ -2,11 +2,6 @@<%= @path %> | -
---|