##// END OF EJS Templates
Makes changes link to entries on the revision view....
Jean-Philippe Lang -
r1538:93b3dba926ef
parent child
Show More
@@ -1,65 +1,67
1 <div class="contextual">
1 <div class="contextual">
2 &#171;
2 &#171;
3 <% unless @changeset.previous.nil? -%>
3 <% unless @changeset.previous.nil? -%>
4 <%= link_to l(:label_previous), :controller => 'repositories', :action => 'revision', :id => @project, :rev => @changeset.previous.revision %>
4 <%= link_to l(:label_previous), :controller => 'repositories', :action => 'revision', :id => @project, :rev => @changeset.previous.revision %>
5 <% else -%>
5 <% else -%>
6 <%= l(:label_previous) %>
6 <%= l(:label_previous) %>
7 <% end -%>
7 <% end -%>
8 |
8 |
9 <% unless @changeset.next.nil? -%>
9 <% unless @changeset.next.nil? -%>
10 <%= link_to l(:label_next), :controller => 'repositories', :action => 'revision', :id => @project, :rev => @changeset.next.revision %>
10 <%= link_to l(:label_next), :controller => 'repositories', :action => 'revision', :id => @project, :rev => @changeset.next.revision %>
11 <% else -%>
11 <% else -%>
12 <%= l(:label_next) %>
12 <%= l(:label_next) %>
13 <% end -%>
13 <% end -%>
14 &#187;&nbsp;
14 &#187;&nbsp;
15
15
16 <% form_tag do %>
16 <% form_tag do %>
17 <%= text_field_tag 'rev', @rev, :size => 5 %>
17 <%= text_field_tag 'rev', @rev, :size => 5 %>
18 <%= submit_tag 'OK' %>
18 <%= submit_tag 'OK' %>
19 <% end %>
19 <% end %>
20 </div>
20 </div>
21
21
22 <h2><%= l(:label_revision) %> <%= format_revision(@changeset.revision) %></h2>
22 <h2><%= l(:label_revision) %> <%= format_revision(@changeset.revision) %></h2>
23
23
24 <p><% if @changeset.scmid %>ID: <%= @changeset.scmid %><br /><% end %>
24 <p><% if @changeset.scmid %>ID: <%= @changeset.scmid %><br /><% end %>
25 <em><%= @changeset.committer.to_s.split('<').first %>, <%= format_time(@changeset.committed_on) %></em></p>
25 <em><%= @changeset.committer.to_s.split('<').first %>, <%= format_time(@changeset.committed_on) %></em></p>
26
26
27 <%= textilizable @changeset.comments %>
27 <%= textilizable @changeset.comments %>
28
28
29 <% if @changeset.issues.any? %>
29 <% if @changeset.issues.any? %>
30 <h3><%= l(:label_related_issues) %></h3>
30 <h3><%= l(:label_related_issues) %></h3>
31 <ul>
31 <ul>
32 <% @changeset.issues.each do |issue| %>
32 <% @changeset.issues.each do |issue| %>
33 <li><%= link_to_issue issue %>: <%=h issue.subject %></li>
33 <li><%= link_to_issue issue %>: <%=h issue.subject %></li>
34 <% end %>
34 <% end %>
35 </ul>
35 </ul>
36 <% end %>
36 <% end %>
37
37
38 <h3><%= l(:label_attachment_plural) %></h3>
38 <h3><%= l(:label_attachment_plural) %></h3>
39 <div style="float:right;">
39 <div style="float:right;">
40 <div class="square action_A"></div> <div style="float:left;"><%= l(:label_added) %>&nbsp;</div>
40 <div class="square action_A"></div> <div style="float:left;"><%= l(:label_added) %>&nbsp;</div>
41 <div class="square action_M"></div> <div style="float:left;"><%= l(:label_modified) %>&nbsp;</div>
41 <div class="square action_M"></div> <div style="float:left;"><%= l(:label_modified) %>&nbsp;</div>
42 <div class="square action_D"></div> <div style="float:left;"><%= l(:label_deleted) %>&nbsp;</div>
42 <div class="square action_D"></div> <div style="float:left;"><%= l(:label_deleted) %>&nbsp;</div>
43 </div>
43 </div>
44 <p><%= link_to(l(:label_view_diff), :action => 'diff', :id => @project, :path => "", :rev => @changeset.revision) if @changeset.changes.any? %></p>
44 <p><%= link_to(l(:label_view_diff), :action => 'diff', :id => @project, :path => "", :rev => @changeset.revision) if @changeset.changes.any? %></p>
45 <table class="list">
45 <table class="list">
46 <tbody>
46 <tbody>
47 <% @changes.each do |change| %>
47 <% @changes.each do |change| %>
48 <tr class="<%= cycle 'odd', 'even' %>">
48 <tr class="<%= cycle 'odd', 'even' %>">
49 <td><div class="square action_<%= change.action %>"></div> <%= change.path %> <%= "(#{change.revision})" unless change.revision.blank? %></td>
49 <td><div class="square action_<%= change.action %>"></div>
50 <%= link_to change.path, :action => 'entry', :id => @project, :path => change.relative_path, :rev => @changeset.revision %>
51 <%= "(#{change.revision})" unless change.revision.blank? %></td>
50 <td align="right">
52 <td align="right">
51 <% if change.action == "M" %>
53 <% if change.action == "M" %>
52 <%= link_to l(:label_view_diff), :action => 'diff', :id => @project, :path => without_leading_slash(change.relative_path), :rev => @changeset.revision %>
54 <%= link_to l(:label_view_diff), :action => 'diff', :id => @project, :path => without_leading_slash(change.relative_path), :rev => @changeset.revision %>
53 <% end %>
55 <% end %>
54 </td>
56 </td>
55 </tr>
57 </tr>
56 <% end %>
58 <% end %>
57 </tbody>
59 </tbody>
58 </table>
60 </table>
59 <p class="pagination"><%= pagination_links_full @changes_pages %></p>
61 <p class="pagination"><%= pagination_links_full @changes_pages %></p>
60
62
61 <% content_for :header_tags do %>
63 <% content_for :header_tags do %>
62 <%= stylesheet_link_tag "scm" %>
64 <%= stylesheet_link_tag "scm" %>
63 <% end %>
65 <% end %>
64
66
65 <% html_title("#{l(:label_revision)} #{@changeset.revision}") -%>
67 <% html_title("#{l(:label_revision)} #{@changeset.revision}") -%>
@@ -1,141 +1,146
1 # redMine - project management software
1 # redMine - project management software
2 # Copyright (C) 2006-2008 Jean-Philippe Lang
2 # Copyright (C) 2006-2008 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.dirname(__FILE__) + '/../test_helper'
18 require File.dirname(__FILE__) + '/../test_helper'
19 require 'repositories_controller'
19 require 'repositories_controller'
20
20
21 # Re-raise errors caught by the controller.
21 # Re-raise errors caught by the controller.
22 class RepositoriesController; def rescue_action(e) raise e end; end
22 class RepositoriesController; def rescue_action(e) raise e end; end
23
23
24 class RepositoriesSubversionControllerTest < Test::Unit::TestCase
24 class RepositoriesSubversionControllerTest < Test::Unit::TestCase
25 fixtures :projects, :users, :roles, :members, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
25 fixtures :projects, :users, :roles, :members, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
26
26
27 # No '..' in the repository path for svn
27 # No '..' in the repository path for svn
28 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository'
28 REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/subversion_repository'
29
29
30 def setup
30 def setup
31 @controller = RepositoriesController.new
31 @controller = RepositoriesController.new
32 @request = ActionController::TestRequest.new
32 @request = ActionController::TestRequest.new
33 @response = ActionController::TestResponse.new
33 @response = ActionController::TestResponse.new
34 Setting.default_language = 'en'
34 Setting.default_language = 'en'
35 User.current = nil
35 User.current = nil
36 end
36 end
37
37
38 if File.directory?(REPOSITORY_PATH)
38 if File.directory?(REPOSITORY_PATH)
39 def test_show
39 def test_show
40 get :show, :id => 1
40 get :show, :id => 1
41 assert_response :success
41 assert_response :success
42 assert_template 'show'
42 assert_template 'show'
43 assert_not_nil assigns(:entries)
43 assert_not_nil assigns(:entries)
44 assert_not_nil assigns(:changesets)
44 assert_not_nil assigns(:changesets)
45 end
45 end
46
46
47 def test_browse_root
47 def test_browse_root
48 get :browse, :id => 1
48 get :browse, :id => 1
49 assert_response :success
49 assert_response :success
50 assert_template 'browse'
50 assert_template 'browse'
51 assert_not_nil assigns(:entries)
51 assert_not_nil assigns(:entries)
52 entry = assigns(:entries).detect {|e| e.name == 'subversion_test'}
52 entry = assigns(:entries).detect {|e| e.name == 'subversion_test'}
53 assert_equal 'dir', entry.kind
53 assert_equal 'dir', entry.kind
54 end
54 end
55
55
56 def test_browse_directory
56 def test_browse_directory
57 get :browse, :id => 1, :path => ['subversion_test']
57 get :browse, :id => 1, :path => ['subversion_test']
58 assert_response :success
58 assert_response :success
59 assert_template 'browse'
59 assert_template 'browse'
60 assert_not_nil assigns(:entries)
60 assert_not_nil assigns(:entries)
61 assert_equal ['folder', '.project', 'helloworld.c', 'textfile.txt'], assigns(:entries).collect(&:name)
61 assert_equal ['folder', '.project', 'helloworld.c', 'textfile.txt'], assigns(:entries).collect(&:name)
62 entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'}
62 entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'}
63 assert_equal 'file', entry.kind
63 assert_equal 'file', entry.kind
64 assert_equal 'subversion_test/helloworld.c', entry.path
64 assert_equal 'subversion_test/helloworld.c', entry.path
65 end
65 end
66
66
67 def test_browse_at_given_revision
67 def test_browse_at_given_revision
68 get :browse, :id => 1, :path => ['subversion_test'], :rev => 4
68 get :browse, :id => 1, :path => ['subversion_test'], :rev => 4
69 assert_response :success
69 assert_response :success
70 assert_template 'browse'
70 assert_template 'browse'
71 assert_not_nil assigns(:entries)
71 assert_not_nil assigns(:entries)
72 assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'], assigns(:entries).collect(&:name)
72 assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'], assigns(:entries).collect(&:name)
73 end
73 end
74
74
75 def test_entry
75 def test_entry
76 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
76 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
77 assert_response :success
77 assert_response :success
78 assert_template 'entry'
78 assert_template 'entry'
79 end
79 end
80
80
81 def test_entry_not_found
81 def test_entry_not_found
82 get :entry, :id => 1, :path => ['subversion_test', 'zzz.c']
82 get :entry, :id => 1, :path => ['subversion_test', 'zzz.c']
83 assert_tag :tag => 'div', :attributes => { :class => /error/ },
83 assert_tag :tag => 'div', :attributes => { :class => /error/ },
84 :content => /The entry or revision was not found in the repository/
84 :content => /The entry or revision was not found in the repository/
85 end
85 end
86
86
87 def test_entry_download
87 def test_entry_download
88 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
88 get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
89 assert_response :success
89 assert_response :success
90 end
90 end
91
91
92 def test_directory_entry
92 def test_directory_entry
93 get :entry, :id => 1, :path => ['subversion_test', 'folder']
93 get :entry, :id => 1, :path => ['subversion_test', 'folder']
94 assert_response :success
94 assert_response :success
95 assert_template 'browse'
95 assert_template 'browse'
96 assert_not_nil assigns(:entry)
96 assert_not_nil assigns(:entry)
97 assert_equal 'folder', assigns(:entry).name
97 assert_equal 'folder', assigns(:entry).name
98 end
98 end
99
99
100 def test_revision
100 def test_revision
101 get :revision, :id => 1, :rev => 2
101 get :revision, :id => 1, :rev => 2
102 assert_response :success
102 assert_response :success
103 assert_template 'revision'
103 assert_template 'revision'
104 assert_tag :tag => 'tr',
104 assert_tag :tag => 'tr',
105 :child => { :tag => 'td', :content => %r{/test/some/path/in/the/repo} },
106 :child => { :tag => 'td',
105 :child => { :tag => 'td',
106 # link to the entry at rev 2
107 :child => { :tag => 'a', :attributes => {:href => 'repositories/entry/ecookbook/test/some/path/in/the/repo?rev=2'},
108 :content => %r{/test/some/path/in/the/repo} }
109 },
110 :child => { :tag => 'td',
111 # link to partial diff
107 :child => { :tag => 'a', :attributes => { :href => '/repositories/diff/ecookbook/test/some/path/in/the/repo?rev=2' } }
112 :child => { :tag => 'a', :attributes => { :href => '/repositories/diff/ecookbook/test/some/path/in/the/repo?rev=2' } }
108 }
113 }
109 end
114 end
110
115
111 def test_revision_with_repository_pointing_to_a_subdirectory
116 def test_revision_with_repository_pointing_to_a_subdirectory
112 r = Project.find(1).repository
117 r = Project.find(1).repository
113 # Changes repository url to a subdirectory
118 # Changes repository url to a subdirectory
114 r.update_attribute :url, (r.url + '/test/some')
119 r.update_attribute :url, (r.url + '/test/some')
115
120
116 get :revision, :id => 1, :rev => 2
121 get :revision, :id => 1, :rev => 2
117 assert_response :success
122 assert_response :success
118 assert_template 'revision'
123 assert_template 'revision'
119 assert_tag :tag => 'tr',
124 assert_tag :tag => 'tr',
120 :child => { :tag => 'td', :content => %r{/test/some/path/in/the/repo} },
125 :child => { :tag => 'td', :content => %r{/test/some/path/in/the/repo} },
121 :child => { :tag => 'td',
126 :child => { :tag => 'td',
122 :child => { :tag => 'a', :attributes => { :href => '/repositories/diff/ecookbook/path/in/the/repo?rev=2' } }
127 :child => { :tag => 'a', :attributes => { :href => '/repositories/diff/ecookbook/path/in/the/repo?rev=2' } }
123 }
128 }
124 end
129 end
125
130
126 def test_diff
131 def test_diff
127 get :diff, :id => 1, :rev => 3
132 get :diff, :id => 1, :rev => 3
128 assert_response :success
133 assert_response :success
129 assert_template 'diff'
134 assert_template 'diff'
130 end
135 end
131
136
132 def test_annotate
137 def test_annotate
133 get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c']
138 get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c']
134 assert_response :success
139 assert_response :success
135 assert_template 'annotate'
140 assert_template 'annotate'
136 end
141 end
137 else
142 else
138 puts "Subversion test repository NOT FOUND. Skipping functional tests !!!"
143 puts "Subversion test repository NOT FOUND. Skipping functional tests !!!"
139 def test_fake; assert true end
144 def test_fake; assert true end
140 end
145 end
141 end
146 end
General Comments 0
You need to be logged in to leave comments. Login now