@@ -81,16 +81,23 class Repository::Mercurial < Repository | |||
|
81 | 81 | |
|
82 | 82 | # Returns the latest changesets for +path+; sorted by revision number |
|
83 | 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 | 90 | def latest_changesets(path, rev, limit=10) |
|
85 | 91 | if path.blank? |
|
86 | changesets.find(:all, :include => :user, :limit => limit) | |
|
92 | changesets.find(:all, :include => :user, :limit => limit, :order => 'id DESC') | |
|
87 | 93 | else |
|
88 | 94 | changesets.find(:all, :select => "DISTINCT #{Changeset.table_name}.*", |
|
89 | 95 | :joins => :changes, |
|
90 | 96 | :conditions => ["#{Change.table_name}.path = ? OR #{Change.table_name}.path LIKE ? ESCAPE ?", |
|
91 | 97 | path.with_leading_slash, |
|
92 | 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 | 101 | end |
|
95 | 102 | end |
|
96 | 103 |
General Comments 0
You need to be logged in to leave comments.
Login now