]> source.dussan.org Git - redmine.git/commitdiff
scm: use to_s for revision in find_changeset_by_name method
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 23 Feb 2012 10:11:19 +0000 (10:11 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 23 Feb 2012 10:11:19 +0000 (10:11 +0000)
On Rails 3.0.11, Subversion functional test fails.

<pre>
Error: test_directory_diff(RepositoriesSubversionControllerTest)
NoMethodError: undefined method `match' for 2:Fixnum
app/models/repository.rb:234:in `find_changeset_by_name'
</pre>

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8931 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/repository.rb

index 8ad339970e077ff704f7f3dd8f3e43cd9f2dfb55..2906646003570f8b61115dd46b9d3fd9f48771c2 100644 (file)
@@ -231,8 +231,9 @@ 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.blank?
-    changesets.find(:first, :conditions => (name.match(/^\d*$/) ?
-          ["revision = ?", name.to_s] : ["revision LIKE ?", name + '%']))
+    s = name.to_s
+    changesets.find(:first, :conditions => (s.match(/^\d*$/) ?
+          ["revision = ?", s] : ["revision LIKE ?", s + '%']))
   end
 
   def latest_changeset