Cleanup of finders with :conditions option.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11963 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-06-12 19:13:25 +00:00
parent 136cdc765a
commit f9ddb562d5
37 changed files with 155 additions and 170 deletions
+9 -12
View File
@@ -143,14 +143,11 @@ class Repository::Cvs < Repository
)
cmt = Changeset.normalize_comments(revision.message, repo_log_encoding)
author_utf8 = Changeset.to_utf8(revision.author, repo_log_encoding)
cs = changesets.find(
:first,
:conditions => {
:committed_on => tmp_time - time_delta .. tmp_time + time_delta,
:committer => author_utf8,
:comments => cmt
}
)
cs = changesets.where(
:committed_on => tmp_time - time_delta .. tmp_time + time_delta,
:committer => author_utf8,
:comments => cmt
).first
# create a new changeset....
unless cs
# we use a temporaray revision number here (just for inserting)
@@ -185,10 +182,10 @@ class Repository::Cvs < Repository
end
# Renumber new changesets in chronological order
Changeset.all(
:order => 'committed_on ASC, id ASC',
:conditions => ["repository_id = ? AND revision LIKE 'tmp%'", id]
).each do |changeset|
Changeset.
order('committed_on ASC, id ASC').
where("repository_id = ? AND revision LIKE 'tmp%'", id).
each do |changeset|
changeset.update_attribute :revision, next_revision_number
end
end # transaction