From 74a2c5a521872280b49077688ccc9fb6234d150d Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Mon, 11 Jun 2012 00:18:24 +0000 Subject: [PATCH] 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 --- app/models/repository/mercurial.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb index bc4962a67..54262d9a6 100644 --- a/app/models/repository/mercurial.rb +++ b/app/models/repository/mercurial.rb @@ -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