scm: mercurial: use to_s for revision in find_changeset_by_name method
On Rails 3.0.11, functional test fails. <pre> Error: test_diff_two_revs(RepositoriesMercurialControllerTest) NoMethodError: undefined method `empty?' for 4:Fixnum app/models/repository/mercurial.rb:76:in `find_changeset_by_name' </pre> git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8938 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7e347069d5
commit
6bdc2c36f1
|
@ -73,14 +73,15 @@ class Repository::Mercurial < Repository
|
|||
|
||||
# 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?
|
||||
if /[^\d]/ =~ name or name.to_s.size > 8
|
||||
e = changesets.find(:first, :conditions => ['scmid = ?', name.to_s])
|
||||
return nil if name.blank?
|
||||
s = name.to_s
|
||||
if /[^\d]/ =~ s or s.size > 8
|
||||
e = changesets.find(:first, :conditions => ['scmid = ?', s])
|
||||
else
|
||||
e = changesets.find(:first, :conditions => ['revision = ?', name.to_s])
|
||||
e = changesets.find(:first, :conditions => ['revision = ?', s])
|
||||
end
|
||||
return e if e
|
||||
changesets.find(:first, :conditions => ['scmid LIKE ?', "#{name}%"]) # last ditch
|
||||
changesets.find(:first, :conditions => ['scmid LIKE ?', "#{s}%"]) # last ditch
|
||||
end
|
||||
|
||||
# Returns the latest changesets for +path+; sorted by revision number
|
||||
|
|
Loading…
Reference in New Issue