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