##// END OF EJS Templates
scm: mercurial: add :order => 'id DESC' explicitly for MySQL test fails....
Toshi MARUYAMA -
r4971:0d63e9e8fde3
parent child
Show More
@@ -81,16 +81,23 class Repository::Mercurial < Repository
81
81
82 # Returns the latest changesets for +path+; sorted by revision number
82 # Returns the latest changesets for +path+; sorted by revision number
83 # Default behavior is to search in cached changesets
83 # Default behavior is to search in cached changesets
84 #
85 # Because :order => 'id DESC' is defined at 'has_many',
86 # there is no need to set 'order'.
87 # But, MySQL test fails.
88 # Sqlite3 and PostgreSQL pass.
89 # Is this MySQL bug?
84 def latest_changesets(path, rev, limit=10)
90 def latest_changesets(path, rev, limit=10)
85 if path.blank?
91 if path.blank?
86 changesets.find(:all, :include => :user, :limit => limit)
92 changesets.find(:all, :include => :user, :limit => limit, :order => 'id DESC')
87 else
93 else
88 changesets.find(:all, :select => "DISTINCT #{Changeset.table_name}.*",
94 changesets.find(:all, :select => "DISTINCT #{Changeset.table_name}.*",
89 :joins => :changes,
95 :joins => :changes,
90 :conditions => ["#{Change.table_name}.path = ? OR #{Change.table_name}.path LIKE ? ESCAPE ?",
96 :conditions => ["#{Change.table_name}.path = ? OR #{Change.table_name}.path LIKE ? ESCAPE ?",
91 path.with_leading_slash,
97 path.with_leading_slash,
92 "#{path.with_leading_slash.gsub(/[%_\\]/) { |s| "\\#{s}" }}/%", '\\'],
98 "#{path.with_leading_slash.gsub(/[%_\\]/) { |s| "\\#{s}" }}/%", '\\'],
93 :include => :user, :limit => limit)
99 :include => :user, :limit => limit,
100 :order => "#{Changeset.table_name}.id DESC" )
94 end
101 end
95 end
102 end
96
103
General Comments 0
You need to be logged in to leave comments. Login now