@@ -30,6 +30,8 class RepositoriesController < ApplicationController | |||
|
30 | 30 | before_filter :authorize |
|
31 | 31 | accept_key_auth :revisions |
|
32 | 32 | |
|
33 | rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed | |
|
34 | ||
|
33 | 35 | def edit |
|
34 | 36 | @repository = @project.repository |
|
35 | 37 | if !@repository |
@@ -56,8 +58,6 class RepositoriesController < ApplicationController | |||
|
56 | 58 | # latest changesets |
|
57 | 59 | @changesets = @repository.changesets.find(:all, :limit => 10, :order => "committed_on DESC") |
|
58 | 60 | show_error_not_found unless @entries || @changesets.any? |
|
59 | rescue Redmine::Scm::Adapters::CommandFailed => e | |
|
60 | show_error_command_failed(e.message) | |
|
61 | 61 | end |
|
62 | 62 | |
|
63 | 63 | def browse |
@@ -68,16 +68,12 class RepositoriesController < ApplicationController | |||
|
68 | 68 | show_error_not_found and return unless @entries |
|
69 | 69 | render :action => 'browse' |
|
70 | 70 | end |
|
71 | rescue Redmine::Scm::Adapters::CommandFailed => e | |
|
72 | show_error_command_failed(e.message) | |
|
73 | 71 | end |
|
74 | 72 | |
|
75 | 73 | def changes |
|
76 | 74 | @entry = @repository.entry(@path, @rev) |
|
77 | 75 | show_error_not_found and return unless @entry |
|
78 | 76 | @changesets = @repository.changesets_for_path(@path) |
|
79 | rescue Redmine::Scm::Adapters::CommandFailed => e | |
|
80 | show_error_command_failed(e.message) | |
|
81 | 77 | end |
|
82 | 78 | |
|
83 | 79 | def revisions |
@@ -111,15 +107,11 class RepositoriesController < ApplicationController | |||
|
111 | 107 | # Prevent empty lines when displaying a file with Windows style eol |
|
112 | 108 | @content.gsub!("\r\n", "\n") |
|
113 | 109 | end |
|
114 | rescue Redmine::Scm::Adapters::CommandFailed => e | |
|
115 | show_error_command_failed(e.message) | |
|
116 | 110 | end |
|
117 | 111 | |
|
118 | 112 | def annotate |
|
119 | 113 | @annotate = @repository.scm.annotate(@path, @rev) |
|
120 | 114 | render_error l(:error_scm_annotate) and return if @annotate.nil? || @annotate.empty? |
|
121 | rescue Redmine::Scm::Adapters::CommandFailed => e | |
|
122 | show_error_command_failed(e.message) | |
|
123 | 115 | end |
|
124 | 116 | |
|
125 | 117 | def revision |
@@ -137,8 +129,6 class RepositoriesController < ApplicationController | |||
|
137 | 129 | end |
|
138 | 130 | rescue ChangesetNotFound |
|
139 | 131 | show_error_not_found |
|
140 | rescue Redmine::Scm::Adapters::CommandFailed => e | |
|
141 | show_error_command_failed(e.message) | |
|
142 | 132 | end |
|
143 | 133 | |
|
144 | 134 | def diff |
@@ -166,8 +156,6 class RepositoriesController < ApplicationController | |||
|
166 | 156 | show_error_not_found unless @diff |
|
167 | 157 | end |
|
168 | 158 | end |
|
169 | rescue Redmine::Scm::Adapters::CommandFailed => e | |
|
170 | show_error_command_failed(e.message) | |
|
171 | 159 | end |
|
172 | 160 | |
|
173 | 161 | def stats |
@@ -217,8 +205,9 private | |||
|
217 | 205 | render_error l(:error_scm_not_found) |
|
218 | 206 | end |
|
219 | 207 | |
|
220 | def show_error_command_failed(msg) | |
|
221 | render_error l(:error_scm_command_failed, msg) | |
|
208 | # Handler for Redmine::Scm::Adapters::CommandFailed exception | |
|
209 | def show_error_command_failed(exception) | |
|
210 | render_error l(:error_scm_command_failed, exception.message) | |
|
222 | 211 | end |
|
223 | 212 | |
|
224 | 213 | def graph_commits_per_month(repository) |
General Comments 0
You need to be logged in to leave comments.
Login now