From 16f9f50f50dbac49b1f791c7c2892420a354bc43 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 25 Mar 2007 12:12:15 +0000 Subject: SVN commits are now stored in the database, and added to the activity view and the search engine. New commits are automatically retrieved and stored when consulting the repository in the app. This behaviour can be disabled by unchecking 'Autofecth commits' in configuration settings. Commits can be fetched offline by running (recommanded at least for the initial import of past commits): ruby script/runner "Repository.fetch_changesets" It will load commits for all of the repositories. git-svn-id: http://redmine.rubyforge.org/svn/trunk@377 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/projects/_form.rhtml | 2 +- app/views/projects/activity.rhtml | 4 ++++ app/views/projects/search.rhtml | 7 +++++++ app/views/repositories/_revisions.rhtml | 20 ++++++++++++++++++++ app/views/repositories/revision.rhtml | 16 ++++++++-------- app/views/repositories/revisions.rhtml | 27 ++++----------------------- app/views/repositories/show.rhtml | 15 ++++++--------- app/views/settings/edit.rhtml | 3 +++ 8 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 app/views/repositories/_revisions.rhtml (limited to 'app/views') diff --git a/app/views/projects/_form.rhtml b/app/views/projects/_form.rhtml index 85f3f2966..ded227197 100644 --- a/app/views/projects/_form.rhtml +++ b/app/views/projects/_form.rhtml @@ -30,7 +30,7 @@ <%= hidden_field_tag "repository_enabled", 0 %>
<% fields_for :repository, @project.repository, { :builder => TabularFormBuilder, :lang => current_language} do |repository| %> -

<%= repository.text_field :url, :size => 60, :required => true %>
(http://, https://, svn://, file:///)

+

<%= repository.text_field :url, :size => 60, :required => true, :disabled => (@project.repository && !@project.repository.root_url.blank?) %>
(http://, https://, svn://, file:///)

<%= repository.text_field :login, :size => 30 %>

<%= repository.password_field :password, :size => 30 %>

<% end %> diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml index b1d131aa9..69bfa6028 100644 --- a/app/views/projects/activity.rhtml +++ b/app/views/projects/activity.rhtml @@ -7,6 +7,7 @@ <%= select_year(@year, :prefix => "year", :discard_type => true) %>

<%= check_box_tag 'show_issues', 1, @show_issues %><%= hidden_field_tag 'show_issues', 0, :id => nil %> <%=l(:label_issue_plural)%>
+ <% if @project.repository %><%= check_box_tag 'show_changesets', 1, @show_changesets %><%= hidden_field_tag 'show_changesets', 0, :id => nil %> <%=l(:label_revision_plural)%>
<% end %> <%= check_box_tag 'show_news', 1, @show_news %><%= hidden_field_tag 'show_news', 0, :id => nil %> <%=l(:label_news_plural)%>
<%= check_box_tag 'show_files', 1, @show_files %><%= hidden_field_tag 'show_files', 0, :id => nil %> <%=l(:label_attachment_plural)%>
<%= check_box_tag 'show_documents', 1, @show_documents %><%= hidden_field_tag 'show_documents', 0, :id => nil %> <%=l(:label_document_plural)%>
@@ -39,6 +40,9 @@ <% elsif e.is_a? WikiContent.versioned_class %> <%= e.created_on.strftime("%H:%M") %> <%=l(:label_wiki_edit)%>: <%= link_to h(WikiPage.pretty_title(e.title)), :controller => 'wiki', :page => e.title %> (<%= link_to '#' + e.version.to_s, :controller => 'wiki', :page => e.title, :version => e.version %>)
<% unless e.comment.blank? %><%=h e.comment %><% end %> + <% elsif e.is_a? Changeset %> + <%= e.created_on.strftime("%H:%M") %> <%=l(:label_revision)%> <%= link_to h(e.revision), :controller => 'repositories', :action => 'revision', :id => @project, :rev => e.revision %>
+ <%=h e.committer %><%= h(": #{e.comment}") unless e.comment.blank? %> <% end %>

diff --git a/app/views/projects/search.rhtml b/app/views/projects/search.rhtml index 056effd47..8b35dce3b 100644 --- a/app/views/projects/search.rhtml +++ b/app/views/projects/search.rhtml @@ -4,6 +4,9 @@ <% form_tag({:action => 'search', :id => @project}, :method => :get) do %>

<%= text_field_tag 'q', @question, :size => 30 %> <%= check_box_tag 'scope[]', 'issues', (@scope.include? 'issues') %> +<% if @project.repository %> +<%= check_box_tag 'scope[]', 'changesets', (@scope.include? 'changesets') %> +<% end %> <%= check_box_tag 'scope[]', 'news', (@scope.include? 'news') %> <%= check_box_tag 'scope[]', 'documents', (@scope.include? 'documents') %> <% if @project.wiki %> @@ -36,6 +39,10 @@ <%=l(:label_wiki)%>: <%= link_to highlight_tokens(h(e.pretty_title), @tokens), :controller => 'wiki', :action => 'index', :id => @project, :page => e.title %>
<%= highlight_tokens(e.content.text, @tokens) %>
<%= e.content.author ? e.content.author.name : "Anonymous" %>, <%= format_time(e.content.updated_on) %> + <% elsif e.is_a? Changeset %> + <%=l(:label_revision)%> <%= link_to h(e.revision), :controller => 'repositories', :action => 'revision', :id => @project, :rev => e.revision %>
+ <%= highlight_tokens(e.comment, @tokens) %>
+ <%= e.committer.blank? ? e.committer : "Anonymous" %>, <%= format_time(e.committed_on) %> <% end %>

<% end %> diff --git a/app/views/repositories/_revisions.rhtml b/app/views/repositories/_revisions.rhtml new file mode 100644 index 000000000..d9bf7cc7c --- /dev/null +++ b/app/views/repositories/_revisions.rhtml @@ -0,0 +1,20 @@ + + + + + + + + + +<% changesets.each do |changeset| %> + + + + + + + +<% end %> + +
#<%= l(:field_author) %><%= l(:label_date) %><%= l(:field_comment) %>
<%= link_to changeset.revision, :action => 'revision', :id => project, :rev => changeset.revision %><%=h changeset.committer %><%= format_time(changeset.committed_on) %><%= textilizable(changeset.comment) %><%= link_to 'Diff', :action => 'diff', :id => project, :path => path, :rev => changeset.revision if entry && entry.is_file? && changeset != changesets.last %>
\ No newline at end of file diff --git a/app/views/repositories/revision.rhtml b/app/views/repositories/revision.rhtml index 22e965090..3f28f3a9c 100644 --- a/app/views/repositories/revision.rhtml +++ b/app/views/repositories/revision.rhtml @@ -5,10 +5,10 @@ <% end %>
-

<%= l(:label_revision) %> <%= @revision.identifier %>

+

<%= l(:label_revision) %> <%= @changeset.revision %>

-

<%= @revision.author %>, <%= format_time(@revision.time) %>

-<%= textilizable @revision.message %> +

<%= @changeset.committer %>, <%= format_time(@changeset.committed_on) %>

+<%= textilizable @changeset.comment %>
<%= l(:label_added) %> 
@@ -19,19 +19,19 @@

<%= l(:label_attachment_plural) %>

-<% @revision.paths.each do |path| %> +<% @changeset.changes.each do |change| %> - + <% end %>
<%= path[:path] %>
<%= change.path %>
-<% if path[:action] == "M" %> -<%= link_to 'View diff', :action => 'diff', :id => @project, :path => path[:path], :rev => @revision.identifier %> +<% if change.action == "M" %> +<%= link_to 'View diff', :action => 'diff', :id => @project, :path => change.path, :rev => @changeset.revision %> <% end %>
-

<%= lwr(:label_modification, @revision.paths.length) %>

+

<%= lwr(:label_modification, @changeset.changes.length) %>

<% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> diff --git a/app/views/repositories/revisions.rhtml b/app/views/repositories/revisions.rhtml index 8e300a9da..52564472d 100644 --- a/app/views/repositories/revisions.rhtml +++ b/app/views/repositories/revisions.rhtml @@ -5,36 +5,17 @@ <% end %>
-

<%= render :partial => 'navigation', :locals => { :path => @path, :kind => @entry.kind, :revision => @rev } %>

+

<%= render :partial => 'navigation', :locals => { :path => @path, :kind => (@entry ? @entry.kind : nil), :revision => @rev } %>

-<% if @entry.is_file? %> +<% if @entry && @entry.is_file? %>

<%=h @entry.name %>

<%= link_to 'Download', {:action => 'entry', :id => @project, :path => @path, :rev => @rev, :format => 'raw' }, :class => "icon file" %> (<%= number_to_human_size @entry.size %>)

<% end %>

Revisions

- - - - - - - - - -<% @revisions.each do |revision| %> - - - - - - - -<% end %> - -
#<%= l(:field_author) %><%= l(:label_date) %><%= l(:field_description) %>
<%= link_to revision.identifier, :action => 'revision', :id => @project, :rev => revision.identifier %><%=h revision.author %><%= format_time(revision.time) %><%= textilizable(revision.message) %><%= link_to 'Diff', :action => 'diff', :id => @project, :path => @path, :rev => revision.identifier if @entry.is_file? && revision != @revisions.last %>
-

<%= lwr(:label_modification, @revisions.length) %>

+<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :changesets => @changesets, :entry => @entry }%> +

<%= lwr(:label_modification, @changesets.length) %>

<% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> diff --git a/app/views/repositories/show.rhtml b/app/views/repositories/show.rhtml index 9c2adc929..e7d71cb79 100644 --- a/app/views/repositories/show.rhtml +++ b/app/views/repositories/show.rhtml @@ -1,17 +1,14 @@

<%= l(:label_repository) %>

-

<%= l(:label_revision_plural) %>

-<% if @latest_revision %> -

<%= l(:label_latest_revision) %>: - <%= link_to @latest_revision.identifier, :action => 'revision', :id => @project, :rev => @latest_revision.identifier %>
- <%= @latest_revision.author %>, <%= format_time(@latest_revision.time) %>

-<% end %> -

<%= link_to l(:label_view_revisions), :action => 'revisions', :id => @project %>

- -

<%= l(:label_browse) %>

<%= render :partial => 'dir_list' %> +<% unless @changesets.empty? %> +

<%= l(:label_latest_revision_plural) %>

+<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :changesets => @changesets, :entry => nil }%> +

<%= link_to l(:label_view_revisions), :action => 'revisions', :id => @project %>

+<% end %> + <% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> <% end %> \ No newline at end of file diff --git a/app/views/settings/edit.rhtml b/app/views/settings/edit.rhtml index 4bdea07b9..223df7a9d 100644 --- a/app/views/settings/edit.rhtml +++ b/app/views/settings/edit.rhtml @@ -45,6 +45,9 @@

<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %>

+

+<%= check_box_tag 'settings[autofetch_changesets]', 1, Setting.autofetch_changesets? %><%= hidden_field_tag 'settings[autofetch_changesets]', 0 %>

+ <%= submit_tag l(:button_save) %> -- cgit v1.2.3