Merged r4703 from trunk (scm: fix error on revision page for empty revision).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.1-stable@4707 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2011-01-13 12:10:52 +00:00
parent 788b143596
commit b877215261
6 changed files with 56 additions and 1 deletions
@@ -139,6 +139,7 @@ class RepositoriesController < ApplicationController
end
def revision
raise ChangesetNotFound if @rev.nil? || @rev.empty?
@changeset = @repository.find_changeset_by_name(@rev)
raise ChangesetNotFound unless @changeset
+1
View File
@@ -94,6 +94,7 @@ class Repository < ActiveRecord::Base
# Finds and returns a revision with a number or the beginning of a hash
def find_changeset_by_name(name)
return nil if name.nil? || name.empty?
changesets.find(:first, :conditions => (name.match(/^\d*$/) ? ["revision = ?", name.to_s] : ["revision LIKE ?", name + '%']))
end