@@ -142,6 +142,15 class RepositoriesController < ApplicationController | |||
|
142 | 142 | end |
|
143 | 143 | |
|
144 | 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 | 154 | @diff_type = params[:type] || User.current.pref[:diff_type] || 'inline' |
|
146 | 155 | @diff_type = 'inline' unless %w(inline sbs).include?(@diff_type) |
|
147 | 156 | |
@@ -156,6 +165,7 class RepositoriesController < ApplicationController | |||
|
156 | 165 | @diff = @repository.diff(@path, @rev, @rev_to) |
|
157 | 166 | show_error_not_found unless @diff |
|
158 | 167 | end |
|
168 | end | |
|
159 | 169 | rescue Redmine::Scm::Adapters::CommandFailed => e |
|
160 | 170 | show_error_command_failed(e.message) |
|
161 | 171 | end |
@@ -84,6 +84,11 | |||
|
84 | 84 | <% end -%> |
|
85 | 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 | 92 | <% html_title(with_leading_slash(@path), 'Diff') -%> |
|
88 | 93 | |
|
89 | 94 | <% content_for :header_tags do %> |
General Comments 0
You need to be logged in to leave comments.
Login now