@@ -134,7 +134,8 class Repository < ActiveRecord::Base | |||||
134 | # Finds and returns a revision with a number or the beginning of a hash |
|
134 | # Finds and returns a revision with a number or the beginning of a hash | |
135 | def find_changeset_by_name(name) |
|
135 | def find_changeset_by_name(name) | |
136 | return nil if name.blank? |
|
136 | return nil if name.blank? | |
137 |
changesets.find(:first, :conditions => (name.match(/^\d*$/) ? |
|
137 | changesets.find(:first, :conditions => (name.match(/^\d*$/) ? | |
|
138 | ["revision = ?", name.to_s] : ["revision LIKE ?", name + '%'])) | |||
138 | end |
|
139 | end | |
139 |
|
140 | |||
140 | def latest_changeset |
|
141 | def latest_changeset | |
@@ -162,7 +163,8 class Repository < ActiveRecord::Base | |||||
162 |
|
163 | |||
163 | # Returns an array of committers usernames and associated user_id |
|
164 | # Returns an array of committers usernames and associated user_id | |
164 | def committers |
|
165 | def committers | |
165 | @committers ||= Changeset.connection.select_rows("SELECT DISTINCT committer, user_id FROM #{Changeset.table_name} WHERE repository_id = #{id}") |
|
166 | @committers ||= Changeset.connection.select_rows( | |
|
167 | "SELECT DISTINCT committer, user_id FROM #{Changeset.table_name} WHERE repository_id = #{id}") | |||
166 | end |
|
168 | end | |
167 |
|
169 | |||
168 | # Maps committers username to a user ids |
|
170 | # Maps committers username to a user ids | |
@@ -172,7 +174,9 class Repository < ActiveRecord::Base | |||||
172 | new_user_id = h[committer] |
|
174 | new_user_id = h[committer] | |
173 | if new_user_id && (new_user_id.to_i != user_id.to_i) |
|
175 | if new_user_id && (new_user_id.to_i != user_id.to_i) | |
174 | new_user_id = (new_user_id.to_i > 0 ? new_user_id.to_i : nil) |
|
176 | new_user_id = (new_user_id.to_i > 0 ? new_user_id.to_i : nil) | |
175 | Changeset.update_all("user_id = #{ new_user_id.nil? ? 'NULL' : new_user_id }", ["repository_id = ? AND committer = ?", id, committer]) |
|
177 | Changeset.update_all( | |
|
178 | "user_id = #{ new_user_id.nil? ? 'NULL' : new_user_id }", | |||
|
179 | ["repository_id = ? AND committer = ?", id, committer]) | |||
176 | end |
|
180 | end | |
177 | end |
|
181 | end | |
178 | @committers = nil |
|
182 | @committers = nil |
General Comments 0
You need to be logged in to leave comments.
Login now