scm: mercurial: use Rails3 ActiveRecord syntax with same as git r9807 at find_changeset_by_name

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9812 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2012-06-11 00:18:24 +00:00
parent 96f5d315ea
commit 74a2c5a521
1 changed files with 4 additions and 4 deletions

View File

@ -76,12 +76,12 @@ class Repository::Mercurial < Repository
return nil if name.blank?
s = name.to_s
if /[^\d]/ =~ s or s.size > 8
e = changesets.find(:first, :conditions => ['scmid = ?', s])
cs = changesets.where(:scmid => s).first
else
e = changesets.find(:first, :conditions => ['revision = ?', s])
cs = changesets.where(:revision => s).first
end
return e if e
changesets.find(:first, :conditions => ['scmid LIKE ?', "#{s}%"]) # last ditch
return cs if cs
changesets.where('scmid LIKE ?', "#{s}%").first
end
# Returns the latest changesets for +path+; sorted by revision number