Project

General

Profile

Patch #9484 » revised-9484.patch

Antonio García-Domínguez, 2011-10-30 16:47

View differences:

app/controllers/repositories_controller.rb
171 171
    @entry = @repository.entry(@path, @rev)
172 172
    (show_error_not_found; return) unless @entry
173 173

  
174
    @annotate = @repository.scm.annotate(@path, @rev)
175
    (render_error l(:error_scm_annotate); return) if @annotate.nil? || @annotate.empty?
176
    @changeset = @repository.find_changeset_by_name(@rev)
174
    @content = @repository.cat(@path, @rev)
175
    (show_error_not_found; return) unless @content
176
    if is_entry_text_data?(@content, @path) && @content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte
177
      render_error :message => l(:error_scm_annotate_big_text_file)
178
    else
179
      @annotate = @repository.scm.annotate(@path, @rev)
180
      (render_error l(:error_scm_annotate); return) if @annotate.nil? || @annotate.empty?
181
      @changeset = @repository.find_changeset_by_name(@rev)
182
    end
177 183
  end
178 184

  
179 185
  def revision
config/locales/en-GB.yml
180 180
  error_scm_not_found: "The entry or revision was not found in the repository."
181 181
  error_scm_command_failed: "An error occurred when trying to access the repository: %{value}"
182 182
  error_scm_annotate: "The entry does not exist or cannot be annotated."
183
  error_scm_annotate_big_text_file: "The entry cannot be annotated, as it exceeds the maximum text file size."
183 184
  error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
184 185
  error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.'
185 186
  error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").'
config/locales/en.yml
176 176
  error_scm_not_found: "The entry or revision was not found in the repository."
177 177
  error_scm_command_failed: "An error occurred when trying to access the repository: %{value}"
178 178
  error_scm_annotate: "The entry does not exist or cannot be annotated."
179
  error_scm_annotate_big_text_file: "The entry cannot be annotated, as it exceeds the maximum text file size."
179 180
  error_issue_not_found_in_project: 'The issue was not found or does not belong to this project'
180 181
  error_no_tracker_in_project: 'No tracker is associated to this project. Please check the Project settings.'
181 182
  error_no_default_issue_status: 'No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").'
config/locales/es.yml
245 245
  error_can_t_load_default_data: "No se ha podido cargar la configuración por defecto: %{value}"
246 246
  error_issue_not_found_in_project: 'La petición no se encuentra o no está asociada a este proyecto'
247 247
  error_scm_annotate: "No existe la entrada o no ha podido ser anotada"
248
  error_scm_annotate_big_text_file: "La entrada no puede anotarse, al superar el tamaño máximo para ficheros de texto."
248 249
  error_scm_command_failed: "Se produjo un error al acceder al repositorio: %{value}"
249 250
  error_scm_not_found: "La entrada y/o la revisión no existe en el repositorio."
250 251
  field_account: Cuenta
test/functional/repositories_subversion_controller_test.rb
334 334
      assert_tag :tag => 'h2', :content => /@ 8/
335 335
    end
336 336

  
337
    def test_annotate_error_when_too_big
338
      assert_equal 0, @repository.changesets.count
339
      @repository.fetch_changesets
340
      @project.reload
341
      assert_equal NUM_REV, @repository.changesets.count
342
      # no files in the test repo is larger than 1KB...
343
      with_settings :file_max_size_displayed => 0 do
344
        get :annotate, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
345
        assert_response 500
346
        assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
347
                                :content => /exceeds the maximum text file size/
348
      end
349
    end
350

  
337 351
    def test_destroy_valid_repository
338 352
      @request.session[:user_id] = 1 # admin
339 353
      assert_equal 0, @repository.changesets.count
(2-2/2)