##// END OF EJS Templates
SCM browser: ability to download raw unified diffs....
Jean-Philippe Lang -
r1500:b78b62df8d1f
parent child
Show More
@@ -142,6 +142,15 class RepositoriesController < ApplicationController
142 end
142 end
143
143
144 def diff
144 def diff
145 if params[:format] == 'diff'
146 @diff = @repository.diff(@path, @rev, @rev_to)
147 show_error_not_found and return unless @diff
148 filename = "changeset_r#{@rev}"
149 filename << "_r#{@rev_to}" if @rev_to
150 send_data @diff.join, :filename => "#{filename}.diff",
151 :type => 'text/x-patch',
152 :disposition => 'attachment'
153 else
145 @diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
154 @diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
146 @diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
155 @diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
147
156
@@ -156,6 +165,7 class RepositoriesController < ApplicationController
156 @diff = @repository.diff(@path, @rev, @rev_to)
165 @diff = @repository.diff(@path, @rev, @rev_to)
157 show_error_not_found unless @diff
166 show_error_not_found unless @diff
158 end
167 end
168 end
159 rescue Redmine::Scm::Adapters::CommandFailed => e
169 rescue Redmine::Scm::Adapters::CommandFailed => e
160 show_error_command_failed(e.message)
170 show_error_command_failed(e.message)
161 end
171 end
@@ -84,6 +84,11
84 <% end -%>
84 <% end -%>
85 <% end -%>
85 <% end -%>
86
86
87 <p class="other-formats">
88 <%= l(:label_export_to) %>
89 <span><%= link_to 'Unified diff', params.merge(:format => 'diff') %></span>
90 </p>
91
87 <% html_title(with_leading_slash(@path), 'Diff') -%>
92 <% html_title(with_leading_slash(@path), 'Diff') -%>
88
93
89 <% content_for :header_tags do %>
94 <% content_for :header_tags do %>
General Comments 0
You need to be logged in to leave comments. Login now